Joeblackdev
Joeblackdev

Reputation: 7327

How can I disable the android emulator keyboard from popping up

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>

Upvotes: 4

Views: 13432

Answers (3)

Dolce Vita
Dolce Vita

Reputation: 31

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();  

Upvotes: 1

Wolfcow
Wolfcow

Reputation: 2735

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.

Upvotes: 3

IZI_Shadow_IZI
IZI_Shadow_IZI

Reputation: 1931

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

Upvotes: 8

Related Questions