简体   繁体   中英

Edittext does not show keyboard

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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