解决BottomSheetDialogFragment
被软键盘遮盖问题
BUG
复现:
解决方法:设置windowSoftInputMode
为adjustResize
<style name="BottomSheetDialogFragmentTheme" parent="Theme.Design.BottomSheetDialog">
<item name="bottomSheetDialogTheme">@style/RoundBottomDialog</item>
<!-- 设置为adjustResize -->
<item name="android:windowSoftInputMode">adjustResize</item>
</style>
<style name="RoundBottomDialog" parent="Widget.Material3.BottomSheet.Modal">
<item name="android:background">@android:color/transparent</item>
<item name="android:windowBackground">#80000000</item>
</style>
将主题设置给BottomSheetDialogFragment
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.BottomSheetDialogFragmentTheme)
}