4

In the following screenshot, I have an image that is followed by a scrollview. The scrollview contains a tablelayout and then some edittext fields, followed by a button

enter image description here

When I want to enter values into my fields, the keyboard pops up and it's blocking my view of the fields, like so:

enter image description here

As you can see, it blocks my view of the edittext fields. Is there an elegant fix for hiding the keyboard? If not, I will change my layout, however I'm not sure what to change. My layout looks like:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#CCCCCC"
    android:weightSum="1" android:id="@+id/llid">
    <TextView ... >
    </TextView> 
    <!-- Image inserted here as an ImageView from my code -->
    <ScrollView 
        android:id="@+id/svid"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="3dp">
        <LinearLayout>
            <TableLayout ... >
                <TableRow>
                    <TextView ... />
                    <TextView ... />            
                </TableRow>
                <TableRow>
                    <TextView ... />
                    <TextView ... />            
                </TableRow> 
                <TableRow>
                    <TextView ... />
                    <TextView ... />            
                </TableRow>                         
            </TableLayout>
            <EditText>  
            ...
            </EditText>
            <EditText>  
            ...
            </EditText> 
            <EditText>  
            ...
            </EditText> 
            <Button>  
            ...
            </Button>                                           
        </LinearLayout>
    </ScrollView>   
</LinearLayout>
Joeblackdev
  • 6,967
  • 23
  • 64
  • 103

3 Answers3

6

My first thought is go to the settings within the emulator:

settings -> language and keyboard and uncheck "Android keyboard" and the other odd ones if they are checked too

IZI_Shadow_IZI
  • 1,851
  • 4
  • 30
  • 59
  • What's the path for that? I have gone into 'menu -> settings -> language & keyboard'. I've unchecked 'Android Keyboard'. I have also unchecked every single option under 'menu -> settings -> language & keyboard -> Android Keyboard Settings' but no joy – Joeblackdev Aug 03 '11 at 14:33
  • It doesn't show up initially when I input a value into my edittext field. But, when I move to the next edittext field and input a value, the keyboard still pops up :S – Joeblackdev Aug 03 '11 at 14:34
  • I've updated my post to reflect my problem more accurately. Any help appreciated. – Joeblackdev Aug 03 '11 at 15:40
  • It seems like its just one of those things that is going to be an annoyance that cant be fixed...because even if you could disable it in the emulator..that wont disable it for the users. – IZI_Shadow_IZI Aug 03 '11 at 18:08
3

Since the emulator is suppose to emulate what would be seen on the phone it makes sense that if you are trying to enter values into a text field the keyboard will pop up. I understand it can be irritating but, you should not try to disable it in your code, because that will disable it on the phone and then how will the user enter their inputs?

Also, you can press the hardware back button to dismiss the keyboard when it pops up.

Wolfcow
  • 2,715
  • 1
  • 15
  • 10
  • Well, this application is only a prototype and so I'm using the emulator. I won't be running it on a phone. It's just a test app so I'm not concerned about running it on a phone. – Joeblackdev Aug 03 '11 at 14:35
  • Second guessing the users intention and other social engineering to avoid the question is not considered a answer. – Pica Jul 21 '18 at 13:43
1

Programmatically you can set keyboard disabled by

public void removeKeyboard(EditText e, Context context){
    InputMethodManager keyB = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
    keyB.hideSoftInputFromWindow(e.getWindowToken(), 0);
}

where EditText e or some other view calling for text input

UPDATE! If you set user input with SearchView i have found some short way to close down the keyboard by just

nameButton.clearFocus();  
Dolce Vita
  • 31
  • 5