【问题标题】:android screen adjusted no work in landscape modeandroid屏幕调整在横向模式下不起作用
【发布时间】:2013-02-21 09:43:25
【问题描述】:

我发现横向模式有问题。 为什么屏幕调整在横向模式下不起作用?软键盘将覆盖 EditText 输入。

它也已经把这条线表现出来了。

android:windowSoftInputMode="adjustResize"

 <?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:orientation="vertical" >


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="200dip"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/android:list"
        android:layout_width="match_parent"
        android:layout_height="10dip"
        android:layout_weight="1" >
    </ListView>
</LinearLayout>

<TextView
    android:id="@+id/android:empty"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Empty"
    android:textColor="#FFFFFF"
    android:textSize="16dp" />

<LinearLayout
    android:id="@+id/linearLayout2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:hint="please input"
        android:imeOptions="flagNoExtractUi"
        android:singleLine="true" >

        <requestFocus />
    </EditText>

    <ImageButton
        android:id="@+id/imageButton1"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:src="@android:drawable/ic_menu_search" />
</LinearLayout>

【问题讨论】:

    标签: android listview resize android-edittext screen-orientation


    【解决方案1】:

    尝试使用RelativeLayout 更好更可调!

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:layout_above="@+id/android:empty"
            android:orientation="vertical" >
    
            <ListView
                android:id="@+id/android:list"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1" >
            </ListView>
        </LinearLayout>
    
        <TextView
            android:id="@+id/android:empty"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/linearLayout2"
            android:textColor="#FFFFFF"
            android:textSize="16dp" />
    
        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_weight="1" >
    
            <EditText
                android:id="@+id/editText1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:hint="please input"
                android:imeOptions="flagNoExtractUi"
                android:singleLine="true" >
    
                <requestFocus />
            </EditText>
        </LinearLayout>
    
    </RelativeLayout>
    

    【讨论】:

    【解决方案2】:

    尝试将LinearLayout 中的listView 放在ScrollView 中。这将解决您的问题。

    【讨论】:

      猜你喜欢
      • 2011-11-15
      • 2021-02-20
      • 1970-01-01
      • 2014-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-10
      • 1970-01-01
      相关资源
      最近更新 更多