简体   繁体   English

android Edit Text键盘出现,并在可扩展列表中突然消失

[英]android Edit Text keyboard appears and suddenly disappears in expandable list

I have this strange problem, when I click on edit text, that is in expandable list view. 当我单击可扩展列表视图中的编辑文本时,我遇到了一个奇怪的问题。 My phone shows keyboard for only one sec.(This does not happen in landscape mode) 我的手机仅显示键盘一秒钟(在横向模式下不会发生)

My listRow details xml: 我的listRow详细信息xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:clickable="true"
    android:orientation="vertical"
    android:paddingLeft="40dp"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:drawableLeft="@drawable/ic_launcher"
        android:drawablePadding="5dp"
        android:gravity="center_vertical"
        android:text="@string/hello_world"
        android:textSize="14sp"
        android:textStyle="bold" 

        >
    </TextView>

    <View
        android:layout_below="@id/textView1"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@android:color/black" />
    <Button 
       android:layout_marginTop="1dp"
       android:layout_below="@id/textView1"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" 
       android:text="Add to list"

        />
    <EditText 
       android:layout_alignParentRight="true"
       android:layout_toRightOf="@id/textView1"
       android:inputType="text"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" 
       android:hint="Quantity"
        />

</RelativeLayout>

ListRowGroup xml ListRowGroup xml

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:layout_marginLeft="8dp"
    android:drawableRight="@drawable/ic_launcher"
    android:gravity="left"
    android:paddingLeft="45dp"
    android:paddingTop="18dp"
    android:text="Test"
    android:textSize="18sp"
    android:textAlignment="textEnd"
    android:textStyle="bold" />

在您的androidmanifest文件中,将此代码放在该活动上,

  android:windowSoftInputMode="adjustPan"

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

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