Dies ist, was ich bisher für meine BottomSheetFragment habe. Ich muss einen Offset marginBottom zum bottomSheet hinzufügen. Einrichten der Marge auf seiner Ansicht, fügt hinzu:Wie fügt man MarginBottom zu einem BottomSheetDialogFragment hinzu?
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
View contentView = View.inflate(getContext(), R.layout.layou_menu_more, null);
dialog.setContentView(contentView);
BottomSheetBehavior<View> mBottomSheetBehavior = BottomSheetBehavior.from(((View) contentView.getParent()));
if (mBottomSheetBehavior != null) {
mBottomSheetBehavior.setBottomSheetCallback(mBottomSheetBehaviorCallback);
mBottomSheetBehavior.setHideable(true);
contentView.requestLayout();
}
View bottomSheet = dialog.findViewById(R.id.bottom_sheet);
FrameLayout.LayoutParams params=new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(0,0,0,90);
bottomSheet.setLayoutParams(params);
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogINterface) {
dialog.getWindow().setLayout(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT);
// dialog.getWindow().setGravity(Gravity.RIGHT);
}
});
return dialog;
}
diese Ansicht erstellt:
wie Sie sehen können, die 90dp Marge für BottomSheet als Polsterung endet. Wie kann ich einen Offset marginBottom
auf die BottomSheetDialogFragment
anwenden?
Haben Sie die Lösung schon gefunden? Können wir marginBottom für BottomSheatDialog einstellen? – TOP