android - 如何使用Edittext和它下面的按钮调整BottomSheet的大小?

标签 android button android-edittext dialog bottom-sheet

我想构建一个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); 

但这不起作用。希望得到一个答案。

enter image description here

enter image description here

最佳答案

将 Bottom Sheet 的所有内容放入滚动 View ,然后尝试。

<ScrollView layout_behavior = "@string/bottom_sheet....">
<your layout/>
<ScrollView>

关于android - 如何使用Edittext和它下面的按钮调整BottomSheet的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50970023/

相关文章:

android - 在每个 ListView 行上显示小计

java - Android - 在本地配置文件中存储一些设置

android - 带有 FragmentPagerAdapter 的 ViewPager 不显示内容

Android 看不到其中一个按钮

java - 当 EditText 输入时清除 TextView

android - 如何从 Listview 编辑文本字段中获取文本值......?

java - 如何以编程方式在 RecyclerView 中设置 cardView 重力

HTML CSS 隐形按钮

java - 我的单选按钮代码出了什么问题?

java - 如何使用java实时更新带有EditText的TextView