Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android软键盘出现时会破坏布局大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是一个布局:
<RelativeLayout xmlns:android="http://scheR_900_11845@as.android.com/apk/res/android"
    xmlns:tools="http://scheR_900_11845@as.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout xmlns:android="http://scheR_900_11845@as.android.com/apk/res/android"
        xmlns:tools="http://scheR_900_11845@as.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可能会有所帮助.

大佬总结

以上是大佬教程为你收集整理的android软键盘出现时会破坏布局全部内容,希望文章能够帮你解决android软键盘出现时会破坏布局所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。