Nic*_*ick 10 android android-layout android-softkeyboard
这是一个布局:
<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>
Run Code Online (Sandbox Code Playgroud)

当触摸EditText并出现软键盘时,我希望蓝条保持不变.即我希望保留它的大小和位置.我android:windowSoftInputMode在AndroidManifest中尝试了我的activity参数的所有四个可能值.并且总是我的蓝色条在软键盘上移动或缩小:
android:windowSoftInputMode="adjustUnspecified" 或默认情况下:

android:windowSoftInputMode="adjustPan"或者android:windowSoftInputMode="adjustNothing":

android:windowSoftInputMode="adjustResize":

当软键盘出现时,它是否可以保持相同的大小和位置?
您必须用作<ScrollView>主要布局。例子:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
....
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
或者在 AndroidManiFest.xml 中使用以下代码:
<activity
android:windowSoftInputMode="adjustNothing">
</activity>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5694 次 |
| 最近记录: |