1

for some reason, my edittext does not show the keyboard when tapped on, i have no idea what is wrong, any help would be greatly appreciated

i have tested this using an emulator and an actual device, but neither work

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Notification text:"
    android:id="@+id/intro"/>

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/intro"
    android:id="@+id/txt_tekstNotif"
    android:textSize="20dp"
    android:lines="4"
    android:focusable="true"/>

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/txt_tekstNotif"
    android:text="@string/cre_notif"
    android:id="@+id/btn_cre_notif"/>

</LinearLayout>
MichaelD
  • 107
  • 1
  • 1
  • 9
  • Try to add this in your `EditText` : `android:focusableInTouchMode="true"` – Skizo-ozᴉʞS ツ Mar 04 '15 at 11:02
  • Everything seems to be right... Can you try by removing last 2 lines of your EditText, plus try copy pasting the same in some other app / project and test it. – shivamDev31 Mar 04 '15 at 11:03
  • 1
    Btw, show us how you where do you instantiate the EditText please – Skizo-ozᴉʞS ツ Mar 04 '15 at 11:04
  • You have `android:layout_width="wrap_content"` `android:layout_height="wrap_content"`. Does the EditText have any contents when you click it? Otherwise you might be not clicking the EditText at all. – George Daramouskas Mar 04 '15 at 11:04
  • As the orientation is Veritcal you can change android:layout_width="wrap_content" to android:layout_width="match_parent" – shivamDev31 Mar 04 '15 at 11:07
  • I don't know if that will solve your problem, but I have seen a similar post. Check [this](http://stackoverflow.com/questions/14810959/edittext-onclick-not-shows-virtual-keyboard) – CAS Mar 04 '15 at 11:07
  • removing the line with textSize fixed it, thanks :D – MichaelD Mar 04 '15 at 11:21

1 Answers1

0

You need to give a size to you EditText otherwise it's size is 0. You set it as "wrap_content" and you have no content. So you either set a background drawable to it or put some text or "hint" in it so it will have an actual size. Just try and put android:layout_width="50dp" android:layout_height="100" and see if it works.

roiberg
  • 13,629
  • 12
  • 60
  • 91