繁体   English   中英

Edittext不显示键盘

[英]Edittext does not show keyboard

出于某种原因,我的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赋予一个大小,否则它的大小为0。将其设置为“ wrap_content”且没有任何内容。 因此,您可以为其设置背景可绘制的背景,或在其中放置一些文本或“提示”,使其具有实际大小。 只需尝试将android:layout_width="50dp" android:layout_height="100" ,看看是否android:layout_width="50dp" android:layout_height="100"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM