• Android软键盘弹出将底部栏顶上去并不会挤压界面


         界面需要,找到了一种不需要去设置android:windowSoftInputMode属性的解决keyboard和layout不适问题

         有关设置android:windowSoftInputMode的资料,可自行百度。

         我的方法就是,将xml文件的根布局设置成ScrollView,将之前的布局嵌套在里面就行了,不需要去设置以上的任何属性

         在中间没有控件显示的地方,使用view设置weight去占位置

        下面给出我的xml布局

        

    <ScrollView 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"
        android:fillViewport="true"
        tools:context="com.example.richedit.TestInputMethodActivity" >
    
        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical">
            <LinearLayout 
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:background="#332423">
                
            </LinearLayout>
            <View android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"/>
            <EditText 
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
            <EditText 
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
            <View 
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"/>
            <RelativeLayout 
                android:layout_width="fill_parent"  
                android:layout_height="54dip"  
                android:background="@android:drawable/bottom_bar">
                <Button  
                    android:id="@+id/manual_setup"  
                    android:text="zuozuo"  
                    android:layout_height="wrap_content"  
                    android:layout_width="wrap_content"  
                    android:minWidth="100dp"  
                    android:layout_alignParentLeft="true"  
                    android:layout_centerVertical="true" />  
                <Button  
                    android:id="@+id/next"  
                    android:text="youyou"  
                    android:layout_height="wrap_content"  
                    android:layout_width="wrap_content"  
                    android:minWidth="100dp"  
                    android:layout_alignParentRight="true"  
                    android:layout_centerVertical="true" />  
            </RelativeLayout>
        </LinearLayout>
    
    </ScrollView>

       这里给出keyb弹出时和没弹出时的效果图,很好的将底部栏顶了上去

      

                 

  • 相关阅读:
    javascript之全局函数
    讲真,MySQL索引优化看这篇文章就够了
    aws亚马逊磁盘扩展卷步骤
    google支付回调验证(备用)
    Linux TCP状态TIME_WAIT 过多的处理
    MySQL索引优化分析
    CSS使图片变模糊,亲测非常好用
    linux ss 命令用法说明
    php一行代码获取本周一,本周日,上周一,上周日,本月一日,本月最后一日,上月一日,上月最后一日日期
    有哪些你追了很多女生才明白的道理?
  • 原文地址:https://www.cnblogs.com/robben/p/4832618.html
Copyright © 2020-2023  润新知