0

I am trying to make Hello World notepad app, and currently I have to click right on the cursor in my EditText to bring up the soft keyboard. I would like to be able to click anywhere in the EditText to show the keyboard.

Here is my EditText declaration in my layout:

<EditText
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="text"  >
</EditText>

EDIT:

I am using the Galaxy Nexus emulator, and here is what I get:

screen

I have to click in the area above the blue marker to get the keyboard.

Imran
  • 12,950
  • 8
  • 64
  • 79
  • 1
    Sounds like something weird with your device. EditText should show the keyboard no matter where you click inside of it – dymmeh Aug 23 '13 at 21:47
  • Checkout [Keyboard not shown when i click on edittextview in android?](http://stackoverflow.com/questions/6977773/keyboard-not-shown-when-i-click-on-edittextview-in-android) – Shobhit Puri Aug 23 '13 at 21:49

2 Answers2

2

Try this :

<EditText
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:inputType="text"  >
</EditText>
Biraj Zalavadia
  • 28,348
  • 10
  • 61
  • 77
  • This is the correct answer. With "wrap_content" the EditText view is quite tiny at the beginning (as you can see yourself in your screenshot). layout_width="match_parent" makes it stretch across the screen (if parent view does so). Setting layout_height to match_parent might be a bit over-exaggerated but surely works. – Ridcully Aug 24 '13 at 13:05
2

Use below code for showing softkeyboard when your edittext get focus for example

youredittext.setOnFocusChangeListener(new OnFocusChangeListener() 
{

@Override
public void onFocusChange(View v, boolean hasFocus) {

if(hasFocus)                                
{

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInputFromInputMethod(youeedittext.getWindowToken(), 0);

}   



}



});

This will show Soft keyboard each time your edittext gewt focus ...if not work use same code in OnClick event for your edittext...

or

Check this in AVD Manager enter image description here

Hope it helps..

mananjani
  • 185
  • 5