前一段时间我曾经遇到了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