Edittext不显示键盘

时间:2015-03-04 10:58:44

标签: android android-edittext

由于某种原因,我的edittext在点击时没有显示键盘,我不知道出了什么问题,任何帮助将不胜感激

我使用模拟器和实际设备对此进行了测试,但都没有工作

<?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>

1 个答案:

答案 0 :(得分:0)

您需要为EditText指定一个大小,否则它的大小为0。 您将其设置为“wrap_content”,并且您没有内容。所以你要么设置一个可绘制的背景,要么在其中添加一些文字或“提示”,这样它就会有一个实际的大小。 试着放android:layout_width="50dp" android:layout_height="100" 并看看它是否有效。