android处理软键盘的方式 我的一些经验

来源:互联网 发布:饥荒修改数据方法 编辑:程序博客网 时间:2024/06/05 14:17

前一段时间我曾经遇到了android处理软键盘的方式,网上有很多吐槽谷歌的,今天偶尔有所发现,分享出来。

1.没有代码的处理 只是简单的设置
2.

这是布局的代码

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical" android:layout_width="match_parent"    android:layout_height="match_parent">    <TextView        android:layout_width="match_parent"        android:layout_height="50dp"        android:text="这是顶部"        android:gravity="center"        android:background="#00ccff"/>    <ScrollView        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_marginTop="50dp"        android:layout_marginBottom="50dp"        android:background="#ff0000">    </ScrollView>    <EditText        android:hint="请输入文字"        android:layout_width="match_parent"        android:layout_height="50dp"        android:gravity="center"        android:layout_alignParentBottom="true"/></RelativeLayout>

这里写图片描述

这是androidmanifast的设置

<activity android:name=".two.Thirty_two"            android:windowSoftInputMode="adjustResize"/>

这里写图片描述

结尾:谷歌的做法还是很好用的 就是鼓励我们在需要输入的页面使用RelativeLayout

0 0
原创粉丝点击