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>
适用于我。