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 回答

繁花不似錦
TA貢獻1851條經驗 獲得超4個贊
“調整大小”
活動的主窗口總是調整大小,以便為屏幕上的軟鍵盤騰出空間。
“調整盤”
活動的主窗口不會調整大小,以便為軟鍵盤騰出空間。相反,窗口的內容會自動平移,這樣當前的焦點就不會被鍵盤遮住,用戶總是可以看到他們正在鍵入的內容。這通常不如調整大小,因為用戶可能需要關閉軟鍵盤才能到達窗口的模糊部分并與之交互。
根據您的評論,在您的活動清單中使用以下內容
<activity?android:windowSoftInputMode="adjustResize">?</activity>

飲歌長嘯
TA貢獻1951條經驗 獲得超3個贊
該設置必須是下表中列出的值之一,或者是一個“state.”的組合。值加一“調整.”價值。在任一組中設置多個值-多個“狀態.”例如,值具有未定義的結果。單獨的值由一個垂直條分隔。例如:
<activity?android:windowSoftInputMode="stateVisible|adjustResize"?.?.?.?>
- 3 回答
- 0 關注
- 309 瀏覽
添加回答
舉報
0/150
提交
取消