1
BottomSheetDialogFragment
以全屏幕寬度顯示,並且沒有底部邊距。我想設置左/右和下邊距。如何使用左/右/下邊距顯示BottomSheetDialogFragment?
我知道我們可以使用BottomSheetBehaviour
並將其應用於我們的佈局中的View
對象。但我想用BottomSheetDialogFragment
BottomSheetDialogFragment
以全屏幕寬度顯示,並且沒有底部邊距。我想設置左/右和下邊距。如何使用左/右/下邊距顯示BottomSheetDialogFragment?
我知道我們可以使用BottomSheetBehaviour
並將其應用於我們的佈局中的View
對象。但我想用BottomSheetDialogFragment
你可以有一個直接的孩子。現在在頂部佈局中使用背景透明和填充,並且只將內容放在佈局內
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/parent_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingBottom="20dp">
<FrameLayout>
Content here
</FrameLayout></RelativeLayout>
適用於我。