android键盘弹出之后界面整体上移,顶出去了
16lz
2021-12-04
关于android编写类似于微信QQ聊天界面,点击底部输入框之后内容被顶出的问题处理
AndroidManifest.xml文件中界面对应的activity里加入
android:windowSoftInputMode="stateVisible|adjustResize" 配置之后压缩listview
注意:此处可能设置android:windowSoftInputMode="stateVisible|adjustResize"无效,我的原因是因为去掉了listview滚动条(android:scrollbars="none")导致,去掉该属性完美解决
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:id="@+id/ll_top" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#F86630" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="top" android:textColor="#FFFFFF" android:textSize="20dp" /> </LinearLayout> <LinearLayout android:id="@+id/ll_bottom" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="#77DA83" android:orientation="horizontal" > <EditText android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="4" /> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="ok" /> </LinearLayout> <ListView android:id="@+id/lv_list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@id/ll_bottom" android:layout_below="@id/ll_top" > </ListView></RelativeLayout>
更多相关文章
- Android学习笔记-界面和数据存储以及一些零碎知识点
- 【Android(安卓)界面效果14】RelativeLayout里常用的位置属性
- Android用户界面 UI组件--AdapterView及其子类(二) AdapterViewA
- Android界面布局基本知识简述
- android键盘弹出之后界面整体上移,顶出去了
- 1.4 android——UI之 UI界面属性用法与注意点汇总
- Android(安卓)在界面中显示以及输入文本信息 TextView和EditText
- Android(安卓)5.1状态栏背景色定制 在Launcher3界面显示透明,在其
- Android(安卓)获取界面上的元素