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弹出时和没弹出时的效果图,很好的将底部栏顶了上去
Android软键盘弹出将底部栏顶上去并不会挤压界面的更多相关文章
- ios 软键盘弹出布局被顶上去 已解决
document.body.addEventListener('focusout', () => { //软键盘收起的事件处理 set ...
- Android软键盘弹出,覆盖h5页面输入框问题
之前我们在使用vue进行 h5 表单录入的过程中,遇到了Android软键盘弹出,覆盖 h5页面 输入框 问题,在此进行回顾并分享给大家: 系统:Android 条件:当输入框在可视区底部或者偏下的位 ...
- android软键盘弹出引起的各种不适终极解决方案
android软键盘弹出引起的各种不适终极解决方案 以下描述如何解决ListView高度小于0时出现的UI问题. 创建RelativeLayout的子类TxrjRelativeLayout publi ...
- Android 软键盘弹出,界面整体上移
在做搜索功能的时候,点击搜索框,搜索框获取焦点,键盘弹出:现在问题出来了,android软键盘弹出的时候,android整个界面上移,布局被挤压,很难看:要解决这个问题,我们需要用到 windowSo ...
- Android软键盘弹出时把布局顶上去的解决方法
原文: 解决Andriod软键盘出现把原来的布局给顶上去的方法(转) 链接:http://blog.sina.com.cn/s/blog_9564cb6e0101g2eb.html 决方法,在main ...
- H5页面关于android软键盘弹出顶起底部元素的解决方案
应用场景:用div在移动端页面设置一个底部工具栏,css的代码大概如下: .tool{ width: 100%; height: 60px; position: fixed; left: 0px; b ...
- Android 软键盘弹出时把布局顶上去,控件乱套解决方法
解决办法:方法一:在你的activity中的oncreate中setContentView之前写上这个代码getWindow().setSoftInputMode(WindowManager.Layo ...
- Android软键盘弹出时布局问题
最近项目需要做一个类似聊天室的模块,基于Socket实现的,这部分稍后一段时间再做总结,功能上的相关点都实现了小例子也做出来了,最后发现一个比较腻歪的问题就是软键盘弹出时总是会把标题“挤出”屏幕,(无 ...
- Android 软键盘弹出时把原来布局顶上去的解决方法
键盘弹出时,会将布局底部的导航条顶上去. 解决办法: 在mainfest.xml中,在和导航栏相关的activity中加: <activity android:name=& ...
随机推荐
- mac下mysql 1045 (28000): Access denied for user 'root'@'localhost' (using password:
新入了mac pro,安装好mysql后,用终端进入mysql遇到个问题: 1045 (28000): Access denied for user 'root'@'localhost' (using ...
- ES常见名词定义
集群:具有相同clusterName的节点.节点:一个ES实例,并不定是一个节点,因为一个节点上可以启动多个ES实例.索引:相当于数据库database的概念,一个集群可以包含多个索引.分片:索引可以 ...
- L167
- EasyDSS RTMP流媒体服务器中调用videojs播放rtmp视频显示在左上角问题
本文转自EasyDarwin团队成员Penggy的博客:http://www.jianshu.com/p/f63f5b7c691b 问题描述: 近期我开发了一款新一代的RTMP/HLS流媒体服务器软件 ...
- 层序遍历二叉树 完整层序重建二叉树 python
给定一个二叉树的完整的层次遍历序列(包含所有节点,包括空节点),利用这个序列生成一颗二叉树. 我们首先来看怎样对一颗二叉树进行层序遍历,下图所示的二叉树层次遍历的结果为[a,b,c,d,e],在这个过 ...
- ZooKeeper 学习资料积累
跟着实例学习ZooKeeper的用法: 临时节点 跟着实例学习ZooKeeper的用法: 缓存 跟着实例学习ZooKeeper的用法: 队列 跟着实例学习ZooKeeper的用法: Barrier 跟 ...
- VS2010对c++11的支持情况验证
目前仅仅测试工作中 使用的比较多的: 智能指针 shared_ptr #include <memory> std::shared_ptr<A> a(new A); ----支持 ...
- TreeSet中自定义Comparator实现降序
@Test public void test1() { TreeSet ts = new TreeSet<Integer>(new MyComparator()); ts.add(3); ...
- [转] Hiredis: redis c client使用注记
编译 使用 初始化 连接redis数据库 redisContext * pConn = redisConnect(redisIp.c_str(), redisPort);if (m_cLocal == ...
- BZOJ2820 YY的GCD 【莫比乌斯反演】
BZOJ2820 YY的GCD Description 神犇YY虐完数论后给傻×kAc出了一题给定N, M,求1<=x<=N, 1<=y<=M且gcd(x, y)为质数的(x, ...