0
新手android開發人員在這裏。我有這個佈局我的對話:對話框:溢出ScrollView內容
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llParent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ScrollView
android:id="@+id/svChild"
android:layout_width="match_parent"
android:layout_height="wrap_content">
... content goes here
</ScrollView>
<Button
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/svChild"
android:text="CANCEL"/>
<Button
android:id="@+id/btnOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/svChild"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:text="OK" />
</RelativeLayout>
當ScrollView
的內容溢出屏幕,它涵蓋下面的按鈕。有時,當更改佈局的某些屬性時,按鈕已經在屏幕之外。
我想要什麼:
- 顯示始終在屏幕底部的按鈕,沒有覆蓋,而不是外界
llParent
和svChild
的高度設置爲wrap_content
這樣,如果內容是相當小,對話框不必佔用所有屏幕的高度
感謝
你好,如果內容太短,這是行不通的。彈出窗口仍佔用整個屏幕。 – KaeL
將scrollview height屬性更改爲android:layout_height =「match_parent」 –
仍然一樣:( – KaeL