这是一个布局:
<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”:
机器人:windowSoftInputMode = “adjustResize”:
当软键出现时,它是否可以保持相同的大小和位置?
解决方法
由于输入进入你的EditText,它总是会移动一些东西.
考虑使用两种布局,一种用于键盘关闭时,一种用于键盘启动时.
使用ViewSwitcher可能会有所帮助.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。