【发布时间】:2015-03-04 10:58:43
【问题描述】:
由于某种原因,我的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>
【问题讨论】:
-
尝试将其添加到您的
EditText:android:focusableInTouchMode="true" -
一切似乎都正确...您可以尝试删除 EditText 的最后 2 行,并尝试将其复制粘贴到其他应用程序/项目中并进行测试。
-
顺便说一句,请告诉我们你是如何实例化 EditText 的
-
你有
android:layout_width="wrap_content"android:layout_height="wrap_content"。当你点击 EditText 时它有任何内容吗?否则你可能根本没有点击 EditText。 -
由于方向是垂直的,您可以将 android:layout_width="wrap_content" 更改为 android:layout_width="match_parent"