猿问

Android中的调整和调整盘的区别?

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>


HUH函数
浏览 327回答 3
3回答

BIG阳

从Android开发者网站链接“调整大小”活动的主窗口总是调整大小,以便为屏幕上的软键盘腾出空间。“调整盘”活动的主窗口不会调整大小,以便为软键盘腾出空间。相反,窗口的内容会自动平移,这样当前的焦点就不会被键盘遮住,用户总是可以看到他们正在键入的内容。这通常不如调整大小,因为用户可能需要关闭软键盘才能到达窗口的模糊部分并与之交互。根据您的评论,在您的活动清单中使用以下内容<activity&nbsp;android:windowSoftInputMode="adjustResize">&nbsp;</activity>

收到一只叮咚

调整尺寸=调整页面内容的大小调节盘=移动页内容而不调整页面内容的大小

素胚勾勒不出你

如博士还请记住正确的值组合:该设置必须是下表中列出的值之一,或者是一个“state.”的组合。值加一“调整.”价值。在任一组中设置多个值-多个“状态.”例如,值具有未定义的结果。单独的值由一个垂直条分隔。例如:<activity&nbsp;android:windowSoftInputMode="stateVisible|adjustResize"&nbsp;.&nbsp;.&nbsp;.&nbsp;>
随时随地看视频慕课网APP

相关分类

Android
我要回答