How to adjust size of BottomSheet with Edittext and button below it?

Refresh

April 2019

Views

271 time

1

I want to build a BottomSheet to display a view with button and edit text. If I click on the Edittext the Keyboard shows up but it hides the button which is below the edit text. These pics should show my problems

1)BottomSheet in normal view-First Image

2)BottomSheet hides the button- Second Image

Here is my code for creating BottomSheet

addNewListBottomSheet = new BottomSheetDialog(this, R.style.BottomSheetDialogTheme);
        View bottomSheetRootView = getLayoutInflater().inflate(R.layout.addnewlist_bottomsheet_layout, null);
        addNewListBottomSheet.setContentView(bottomSheetRootView);

I also added a specific style

<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">

i also tried to change the behavior with

addNewListBottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 

but it doesn't work. Would appreciate an answer.

enter image description here

enter image description here

1 answers

0

Put all the content of the bottomsheet in the scrollview and try.

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