一般edtext activity ,fragment 在注册文件中加上:
android:windowSoftInputMode="stateHidden|adjustPan" 就行,但BottomSheetDialogFragment没什么用,需要设置style
public Dialog onCreateDialog(Bundle savedInstanceState) { if (getContext() == null) { return super.onCreateDialog(savedInstanceState); } return new BottomSheetDialog(getContext(), R.style.CommentBottomSheetStyle); }
sytes.xml中
<style name="CommentBottomSheetStyle" parent="Theme.Design.Light.BottomSheetDialog"> <item name="android:windowIsFloating">false</item> <item name="android:windowSoftInputMode">adjustResize</item> </style>