Android中的调整和调整盘的区别?我试图编写一个代码,用于在以下情况下重新调整ui组件的大小。软键盘出现了。当我用调整大小,它重新调整了ui组件的大小,同时也对用户界面组件进行了调整。调节盘给了我同样的输出。我想知道它们之间的区别,以及何时使用每个组件?哪一个(调整盘或调整大小)对调整UI有好处?以下是我的XML:<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<EditText
android:id="@+id/editText5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:ems="10"
android:inputType="textPersonName" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:text="My Button" />
</LinearLayout>
</RelativeLayout></ScrollView>
3 回答
![?](http://img1.sycdn.imooc.com/54584f3100019e9702200220-100-100.jpg)
繁花不似锦
TA贡献1851条经验 获得超4个赞
“调整大小”
活动的主窗口总是调整大小,以便为屏幕上的软键盘腾出空间。
“调整盘”
活动的主窗口不会调整大小,以便为软键盘腾出空间。相反,窗口的内容会自动平移,这样当前的焦点就不会被键盘遮住,用户总是可以看到他们正在键入的内容。这通常不如调整大小,因为用户可能需要关闭软键盘才能到达窗口的模糊部分并与之交互。
根据您的评论,在您的活动清单中使用以下内容
<activity android:windowSoftInputMode="adjustResize"> </activity>
![?](http://img1.sycdn.imooc.com/5333a1d100010c2602000200-100-100.jpg)
饮歌长啸
TA贡献1951条经验 获得超3个赞
该设置必须是下表中列出的值之一,或者是一个“state.”的组合。值加一“调整.”价值。在任一组中设置多个值-多个“状态.”例如,值具有未定义的结果。单独的值由一个垂直条分隔。例如:
<activity android:windowSoftInputMode="stateVisible|adjustResize" . . . >
- 3 回答
- 0 关注
- 290 浏览
添加回答
举报
0/150
提交
取消