Android中的調(diào)整和調(diào)整盤的區(qū)別?我試圖編寫一個代碼,用于在以下情況下重新調(diào)整ui組件的大小。軟鍵盤出現(xiàn)了。當(dāng)我用調(diào)整大小,它重新調(diào)整了ui組件的大小,同時也對用戶界面組件進行了調(diào)整。調(diào)節(jié)盤給了我同樣的輸出。我想知道它們之間的區(qū)別,以及何時使用每個組件?哪一個(調(diào)整盤或調(diào)整大小)對調(diào)整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條經(jīng)驗 獲得超4個贊
“調(diào)整大小”
活動的主窗口總是調(diào)整大小,以便為屏幕上的軟鍵盤騰出空間。
“調(diào)整盤”
活動的主窗口不會調(diào)整大小,以便為軟鍵盤騰出空間。相反,窗口的內(nèi)容會自動平移,這樣當(dāng)前的焦點就不會被鍵盤遮住,用戶總是可以看到他們正在鍵入的內(nèi)容。這通常不如調(diào)整大小,因為用戶可能需要關(guān)閉軟鍵盤才能到達窗口的模糊部分并與之交互。
根據(jù)您的評論,在您的活動清單中使用以下內(nèi)容
<activity?android:windowSoftInputMode="adjustResize">?</activity>

眼眸繁星
TA貢獻1873條經(jīng)驗 獲得超9個贊
調(diào)整尺寸
調(diào)節(jié)盤

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