2

I am trying to use a bottomsheet dialog with edit text inside, I have these screenshots:

enter image description here

enter image description here

In the second image, the keyboard cuts the UI element, which should be pushed the layout up.

Here's my code

public void setUpBottomSheetDialog() {
    View bottomSheetDialog = getLayoutInflater().inflate(R.layout.bottom_layout2, null);
    bsDialog = new BottomSheetDialog(MainActivity.this);
    bsDialog.setContentView(bottomSheetDialog);
    bsDialog.setCanceledOnTouchOutside(false);
    bsDialog.setCancelable(true);

and

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical"
app:behavior_hideable="false"
app:behavior_peekHeight="56dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="30dp"
    android:gravity="center"
    android:orientation="horizontal"
    android:weightSum="1">
    <ImageView
        android:id="@+id/bs_imv_tag"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        app:srcCompat="@mipmap/ic_launcher_round" />
  <EditText
        android:id="@+id/bs_Etx"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_weight="0.99"
        android:ems="10"
        android:hint="type your note"
        android:inputType="textCapSentences|textMultiLine"
        android:maxHeight="80dp"
        android:maxLines="4"
        android:textColor="#000"
        android:textColorHint="#4e97bc" />
    <ImageView
        android:id="@+id/bs_imv_save"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        app:srcCompat="@mipmap/ic_launcher_round" />
</LinearLayout>
 <View
    android:layout_width="match_parent"
    android:layout_height="40dp" />
</LinearLayout>

Could you hint me out where to modify?

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
Avinash
  • 145
  • 9

1 Answers1

0

Try using

getActivity().getWindow().setSoftInputMode(
                WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

Reference this question

dalla92
  • 432
  • 2
  • 8