这是一个布局:
<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="match_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
<FrameLayout
android:background="#0000ff"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
</LinearLayout>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
当EditText被触摸并出现软键盘时,我希望蓝色条保持不变。也就是说,我希望它的大小和位置得到保留。我尝试了AndroidManifest中我的activity参数android:windowSoftInputMode
的四个可能值。然而每次当软键盘出现时,我的蓝色条都会移动或缩小:
android:windowSoftInputMode="adjustUnspecified"
或默认值:
android:windowSoftInputMode="adjustPan"
或 android:windowSoftInputMode="adjustNothing"
:
android:windowSoftInputMode="adjustResize"
:
是否有可能在软键盘出现时保持其相同的大小和位置?
adjustNothing
,在我的设备上(Google Nexus)似乎有效。 - sdabet