我想构建一个BottomSheet以显示带有按钮的 View 并编辑文本。如果我单击Edittext,则会显示键盘,但它会隐藏编辑文本下方的按钮。
这些照片应该显示我的问题
1)普通 View 中的BottomSheet-第一个图像
2)BottomSheet隐藏按钮-第二张图片
这是我创建BottomSheet的代码
addNewListBottomSheet = new BottomSheetDialog(this, R.style.BottomSheetDialogTheme);
View bottomSheetRootView = getLayoutInflater().inflate(R.layout.addnewlist_bottomsheet_layout, null);
addNewListBottomSheet.setContentView(bottomSheetRootView);
我还添加了特定的样式
<style name="BottomSheet" parent="@style/Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/bottomsheet_round_bg</item>
</style>
<style name="BaseBottomSheetDialog" parent="@style/Theme.Design.Light.BottomSheetDialog">
<item name="android:windowIsFloating">true</item>
<item name="bottomSheetStyle">@style/BottomSheet</item>
</style>
<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog">
我也试图改变行为
addNewListBottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
但这不起作用。希望得到一个答案。
最佳答案
将 Bottom Sheet 的所有内容放入滚动 View ,然后尝试。
<ScrollView layout_behavior = "@string/bottom_sheet....">
<your layout/>
<ScrollView>
关于android - 如何使用Edittext和它下面的按钮调整BottomSheet的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50970023/