button at the bottom of layout not going up when keyboard comes

1k Views Asked by At

I have a RelativeLayout in which at the top I have an EditText and at the bottom I have an next Button.. when I click the EditText I want the next Button to appear above the keyboard.. I have use the adjust panel in Manifiest but still it does not work

 <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <com.alimuzaffar.lib.pin.PinEntryEditText
            android:id="@+id/txt_pin_entry"
            android:focusable="true"
            android:layout_below="@+id/tv_phoneno_otp"
            android:layout_marginTop="@dimen/margin_top_otp_small"
            android:layout_width="@dimen/otp_dimen"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/margin_left_otp"
            android:cursorVisible="true"
            app:pinLineColors="@color/colorPrimary"
            android:digits="1234567890"
            android:inputType="number"
            android:maxLength="4"
            android:textIsSelectable="true"
            android:textSize="20sp"
            android:layout_marginStart="@dimen/margin_left_otp" />


   <Button
            android:id="@+id/btn_next_btn_otp"
            android:layout_width="@dimen/min_width"
            android:layout_height="@dimen/min_width"
            android:layout_alignParentRight="true"
            android:background="@drawable/back_btn"
            android:layout_marginRight="@dimen/margin_left_button_login"
            android:layout_marginEnd="@dimen/margin_left_button_login"
            android:layout_alignParentEnd="true"
            android:layout_below="@+id/txt_pin_entry"
            android:layout_marginTop="@dimen/margin_small_text_sub"/>


</RelativeLayout>
1

There are 1 best solutions below

0
milad salimi On

In the Android Manifest, give the property android:windowSoftInputMode="adjustResize". This will resize your layout when keyboard shows.

Like this :

<activity
        android:name=".MainActivity"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustResize">
    </activity>