1
我有一項活動顯示屏幕上少於1頁的數據。 因此,當我按下屏幕上的編輯框時,鍵盤會隱藏UI組件(位於其下方)。Android滾動視圖 - 顯示鍵盤時需要滾動 - 儘管數據少於1頁
問題在於沒有啓用滾動(因爲有大量數據)。 如何強制滾動?
我有一項活動顯示屏幕上少於1頁的數據。 因此,當我按下屏幕上的編輯框時,鍵盤會隱藏UI組件(位於其下方)。Android滾動視圖 - 顯示鍵盤時需要滾動 - 儘管數據少於1頁
問題在於沒有啓用滾動(因爲有大量數據)。 如何強制滾動?
您應該用ScrollView環繞佈局。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/editText1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="text" >
<requestFocus />
</EditText>
</LinearLayout>
</ScrollView>