解决位于底端Edittext 输入时被软盘遮盖

  1. 遇到这种情况我们首先到网上搜一圈,大概情况是需要设置<activity/> 

    android:windowSoftInputMode="adjustResize" ,按照以上属性设置了,问题依然存在没有解决。

  2. 通过反复试验,得出结论布局文件的layout_weight权重为影响软盘覆盖edittext。成功的xml文件如下:
  3. <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#f4f6f5"
        android:orientation="vertical" >
    
        <!-- head bar -->
        <include layout="@layout/include_head_bar" />
    
        <ListView
            android:id="@+id/listview"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" 
            android:layout_marginLeft="10.0dip"
            android:layout_marginRight="10.0dip"
            android:layout_marginTop="10.0dip"
            android:cacheColorHint="#00000000"
            android:divider="@null"
            android:dividerHeight="5dp"
            android:scrollbars="none" />
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="5" >
    
            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp" >
    
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:background="#f5f5f5" >
    
                    <ImageButton
                        android:id="@+id/btnVoice"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="#00000000"
                        android:paddingLeft="5dp"
                        android:src="@drawable/voice" />
    
                    <EditText
                        android:id="@+id/txtContent"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left"
                        android:layout_marginLeft="5dp"
                        android:layout_weight="1"
                        android:background="@drawable/shape_consult_search"
                        android:completionThreshold="1"
                        android:hint="输入内容"
                        android:paddingLeft="8dp"
                        android:textColor="#000000"
                        android:textColorHint="#c2c2c2"
                        android:textCursorDrawable="@null" />
    
                    <ImageButton
                        android:id="@+id/btnPic"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="5dp"
                        android:background="#00000000"
                        android:src="@drawable/pic" />
    
                    <Button
                        android:id="@+id/btnConsult"
                        android:layout_width="wrap_content"
                        android:layout_height="40dp"
                        android:layout_marginLeft="5dp"
                        android:layout_marginRight="5dp"
                        android:background="@drawable/shape_consult_top_btn_press"
                        android:text="发送"
                        android:textColor="#ffffff" />
                </LinearLayout>
            </RelativeLayout>
        </LinearLayout>
    
    </LinearLayout>

    效果图:

  4. 经过反复测试,还得出另一解决方案。需要将权重比较大的组件放到相对布局文件中,请看xml布局文件
  5. <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:background="#e9e9e9"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:orientation="vertical" >
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#f0f0f0"
            android:gravity="center_vertical" >
    
            <TextView
                android:id="@+id/return_back"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:drawableLeft="@drawable/return_back"
                android:gravity="center|center_vertical"
                android:paddingLeft="15dp"
                android:text="@string/return_back"
                android:textColor="#20bf63"
                android:textSize="22sp" />
    
            <TextView
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="2"
                android:gravity="center|center_vertical"
                android:text="@string/zx_tit"
                android:textColor="#000000"
                android:textSize="22sp" />
    
            <TextView
                android:layout_width="40dp"
                android:layout_height="match_parent"
                android:gravity="center_vertical"
                android:singleLine="true" />
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#ffffff"
            android:orientation="vertical"
            android:paddingBottom="15dp"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"
            android:paddingTop="10dp" >
    
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_gravity="left"
                    android:layout_weight="1"
                    android:text="@string/zx_name"
                    android:textColor="#8b8b8b"
                    android:textSize="18sp" />
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_alignParentRight="true"
                    android:layout_gravity="right"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:text="@string/zx_time"
                    android:textColor="#8b8b8b"
                    android:textSize="18sp" />
            </LinearLayout>
    
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:text="@string/zx_text"
                android:textColor="#000000"
                android:textSize="18sp" />
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" >
    
            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
    
                <ListView
                    android:id="@+id/listview"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10.0dip"
                    android:layout_marginRight="10.0dip"
                    android:layout_marginTop="10.0dip"
                    android:cacheColorHint="#00000000"
                    android:divider="@null"
                    android:dividerHeight="5dp" />
    
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:background="#f5f5f5" >
    
                    <EditText
                        android:id="@+id/txtContent"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left"
                        android:layout_marginLeft="5dp"
                        android:layout_weight="1"
                        android:background="@drawable/shape_consult_search"
                        android:completionThreshold="1"
                        android:hint="输入内容"
                        android:paddingLeft="8dp"
                        android:textColor="#000000"
                        android:textColorHint="#c2c2c2"
                        android:textCursorDrawable="@null" />
    
                    <Button
                        android:id="@+id/btnConsult"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_marginLeft="5dp"
                        android:layout_marginRight="5dp"
                        android:background="@drawable/shape_consult_top_btn_press"
                        android:text="发送"
                        android:textColor="#ffffff" />
                </LinearLayout>
            </RelativeLayout>
        </LinearLayout>
    
    </LinearLayout>

    我们首先分析下这个布局文件:由三个linearlayout组成,其中前两个layout的高度肯定可以确定其高度,第三个layout比较复杂,包含一个 listView  relativelayout ,listview

  6. 中的内容是动态的,也就是说高度不定,内容不定;而且还有下边[发送]必须在屏幕的底端显示;假如我们把listview提到独立的layout中,当我们点击edittext输入内容时,就会被
  7. 软盘挡住。
  8. 另还需注意,具体问题具体分析。

转载于:https://www.cnblogs.com/gaolizhong/p/4380848.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
最新版.管家婆分销ERP系列是一套针对具有一定规模的企业应用的信息化管理整体解决方案,集进销存、财务、分销、OA管理一体化,致力于帮助企业建立起一个简捷、高效的实运营管理平台,实现物流、资金流、信息流的在线动态监控和管理,实现信息的全面把控、传递和电脑全程记录,为企业决策提供数据。 管家婆分销ERP系列采用B/S结构,应用Internet,企业总部与各分支机构,甚至供应商和代理商在同一平台上协同办公,实现对异地分支机构销售、库存、费用、办公等信息的全方位实掌控。 产品特点 实施快捷 维护方便 完全互联网应用,只需要服务器进行安装和设置,客户端无需装软件,不需要很强的 IT实施能力,7-30天即可完成实施 分支机构独立核算(仅限V3) 实现分支机构(按分公司、产品线、事业部等划分)财务、业务状况的独立核算和汇 总分析 强大的分析能力 多方面多维度的报表分析,各项数据及、准确、清晰、全方位支持企业科学决策 集成行业特性 完备的序列号管理、强大的维修管理,灵活多样的会员管理,严格的审批流程管理, 实用的价格保护功能 领先技术 安全可靠 依托SQL Server2008 R2数据库,采用先进的MemoryCacheD和Microsoft Silverlight技术开发,技术领先。支持安全钥匙、客户端电脑IP、MAC地址、硬盘序列号绑定 应用价值 完善的物流处理能力和全方位的业务流程控制,极大地提高了企业的运作效率 帮助企业实现从传统企业的事后管理转变为有效的动态监控机制 随确认并监控各区域市场价格体系,最大限度地减少价格混乱和窜货现象 动态地调拨各地分仓的物流速度和频度,最大限度地减少库存积压,甚至减少库损 实掌控各地分公司的财务流,有效地控制费用的不良支出 有效地掌控分布在各地的天马行空般的销售人员的工作情况 让所有与企业相关的分公司、办事处、门店、分仓库、经销商等广泛地参与进来,真正实现"分布应用、集中处理"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值