在我的應用程序中,我使用的主題爲「Theme.AppCompat.Dialog」的Activity將其顯示爲對話框。這很好,但是,對話框填滿了整個屏幕高度,留下了很多空間。爲了說明我的問題,這裏是打開的對話框中(在一個非常高的分辨率來證明這個問題更好)的照片:Theme.AppCompat.Dialog主題創建空(死)空間
分辨率越高,越大這個空間。
下面的代碼片段:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools">
<!--This is the yellow box-->
<LinearLayout
android:id="@+id/dialog_button_bar"
android:layout_alignParentBottom="true"
style="?android:buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
[Buttons...]
</LinearLayout>
<!--This is the red box-->
<ScrollView
android:layout_above="@id/dialog_button_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
[LinearLayout containing rows...]
</ScrollView>
如果我刪除android:layout_alignParentBottom="true"
和android:layout_above="@id/dialog_button_bar"
屬性,整個佈局跳轉到頂部,現在空的空間低於我的佈局。
我在做什麼錯? :(
沒有幫助 :( – Aenadon