BottomSheetDialog
style.xml中继承Theme.Design.Light.BottomSheetDialog
<style name="BottomSheetEdit" parent="Theme.Design.Light.BottomSheetDialog">
<item name="android:windowIsFloating">false</item>
<item name="android:windowSoftInputMode">adjustResize</item>
</style>
BottomSheetDialog
BottomDialogFragment的onCreate中加入
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.BottomSheetEdit);
}
注意事项
dialog中内容过高时,需要在show方法后添加如下代码
FrameLayout bottomSheet = findViewById(android.support.design.R.id.design_bottom_sheet);
BottomSheetBehavior<FrameLayout> behavior = BottomSheetBehavior.from(bottomSheet);
behavior.setState(STATE_EXPANDED);