Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Listview内部编辑键盘覆盖的文本类型_Android_Android Layout - Fatal编程技术网

Android Listview内部编辑键盘覆盖的文本类型

Android Listview内部编辑键盘覆盖的文本类型,android,android-layout,Android,Android Layout,列表视图内容具有编辑文本和文本视图。在键入listview编辑文本底部时动态加载的列表视图内容,未显示填充的编辑文本。虚拟键盘覆盖编辑文本 我也在活动中使用了此代码: getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); 我在清单文件中使用了adjustpan、resize、statevisible,但并没

列表视图内容具有编辑文本和文本视图。在键入listview编辑文本底部时动态加载的列表视图内容,未显示填充的编辑文本。虚拟键盘覆盖编辑文本

我也在活动中使用了此代码:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
我在清单文件中使用了adjustpan、resize、statevisible,但并没有任何改变。但它在4.0以下的版本中工作得很好

customlist.xml作为

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"   android:layout_weight="1" 
    android:layout_height="match_parent" >

    <View
        android:id="@+id/view"
        android:layout_width="2dp"
        android:layout_height="fill_parent"
        android:layout_centerInParent="true"
        android:background="@android:color/transparent" />

    <EditText 
        android:id="@+id/textView21"
        android:layout_width="341dp"
        android:layout_height="60dp"
         android:layout_alignParentBottom="true"
        android:layout_weight="1" 
        android:layout_centerVertical="true"
        android:layout_marginRight="20dp"
        android:layout_toRightOf="@+id/view"
        android:background="@drawable/txt1"
        android:hint="Enter Value"
        android:layout_marginBottom="8dp"  
        android:layout_marginTop="8dp"  android:imeOptions="flagNoExtractUi"
        android:focusable="true" 
        android:paddingLeft="10dp" android:paddingRight="5dp"
        android:paddingTop="5dp"  android:singleLine="true"
        android:paddingBottom="5dp"
        android:textSize="25dp"
        android:textColor="@color/app_text_color"
         />

    <TextView
        android:id="@+id/textView1" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="20dp"
        android:layout_toLeftOf="@+id/view"
        android:paddingBottom="5dp"
        android:paddingLeft="10dp"
        android:paddingTop="5dp"   android:textSize="25dp"
        android:text="Large ryw4rtb "
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="@color/app_text_color"
       />

</RelativeLayout>

和main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_marginBottom="5dp" android:id="@+id/sceen"
    android:background="@drawable/full_bg"
    android:orientation="vertical" >

    <include
        android:id="@+id/titleLayout"
        layout="@layout/title" />

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal" >

        <LinearLayout
            android:id="@+id/left"
            android:layout_width="326dp"
            android:layout_height="fill_parent"
            android:background="@drawable/left_bg" >

            <ListView 
                android:id="@+id/list"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="20dp"
                android:background="@drawable/left_table_bg"
                android:cacheColorHint="#00000000"
                android:transcriptMode="alwaysScroll"
                android:layout_weight="1"
                android:divider="@drawable/left_table_line"
                android:paddingLeft="5dp"
                android:paddingRight="5dp" >
            </ListView>
        </LinearLayout>

        <RelativeLayout
            android:id="@+id/lay_healthy"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_marginBottom="5dp"
            android:background="@drawable/right_side_bg" >
 <RelativeLayout
            android:id="@+id/lay_healthy1"   android:layout_above="@+id/btn"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
             >

            <ListView
                android:id="@+id/listView1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                android:layout_weight="1" 
                android:layout_alignParentTop="true"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/available_right_bg"
                android:cacheColorHint="#00000000"
                android:padding="20dp" />

             <ListView
                android:id="@+id/listView2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                android:layout_alignParentTop="true"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/available_right_bg"
                android:cacheColorHint="#00000000"
                android:padding="20dp"
                android:visibility="gone" />

             <ListView
                android:id="@+id/listView3"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"

                android:layout_alignParentTop="true"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/available_right_bg"
                android:cacheColorHint="#00000000"
                android:padding="20dp"
                android:visibility="gone" />
           </RelativeLayout> 



        <RelativeLayout
                android:id="@+id/btn" 
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_above="@+id/btn1" 
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="20dp"
                android:layout_marginTop="10dp" >

                <Button 
                    android:id="@+id/button1"
                    android:layout_width="200dp"
                    android:layout_height="57dp"
                    android:layout_alignParentLeft="true"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="160dp"
                    android:background="@drawable/bt_submit" />

                <Button
                    android:id="@+id/button2"
                    android:layout_width="200dp"
                    android:layout_height="57dp"
                    android:layout_alignParentRight="true"
                    android:layout_marginBottom="10dp"
                    android:layout_marginRight="160dp"
                    android:background="@drawable/bt_reset" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/btn1"
                android:layout_width="fill_parent"
                android:layout_height="20dp"
                android:layout_alignParentBottom="true" >
            </RelativeLayout>
              </RelativeLayout>
    </LinearLayout>

</LinearLayout>


请帮助我解决此问题。

尝试将其添加到声明活动的清单中

     <activity android:name=".YourActivity"
     android:windowSoftInputMode="stateHidden"/>

除了您正在填写的
编辑文本
之外,您肯定还有其他视图,如
标题
按钮

所以

跟踪软键盘是否打开,使这些视图不可见,并在软键盘关闭/隐藏时使其可见

无法直接跟踪显示/隐藏的软键盘,因此请使用我在应用程序中使用的以下代码:

//your_button is the layout of your button view or a header view. if its just a view cast it to

//appropriate Class
final LinearLayout your_button = (LinearLayout) findViewById(R.id.your_button);
//activityRootView is the Layout you are using for the Activity
final View activityRootView = findViewById(R.id.layout_parent);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            @Override
public void onGlobalLayout() {
    int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
    if (heightDiff > 100) { // if more than 100 pixels, its probably a keyboard...

    your_button.setVisibility(Visibility.GONE);
    }else{

    your_button.setVisibility(Visibility.VISIBLE);
        }
    }
});

谢谢,但是布局没有改变,当我在底部键入编辑文本时,编辑文本不可见。将“stateHidden”替换为“adjustResize”,我尝试使用android:WindowsofInputMode=“stateVisible | adjustResize | adjustPan”,但没有改变。LayoutParams.FLAG(布局)无限制,允许窗口扩展到屏幕之外。android:WindowsOfInputMode=“stateVisible | adjustResize | adjustPan”它将在2.2上工作,而不是在3.0或更高版本上。我需要在键入时显示编辑文本。但它将变为不可见。请尝试以下操作: