简体   繁体   English

键盘出现时布局底部的按钮不会上升

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

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 ,其中顶部有一个EditText ,底部有一个下一个Button .. 当我单击EditText我希望下一个Button出现在键盘上方.. 我在Manifiest使用了调整面板,但是还是不行

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

Do your application use fullscreen? 您的应用程序使用全屏显示吗? If the answer is yes.. you can't move your button "next" up. 如果答案是肯定的,那么您不能将按钮“下一个”向上移动。 You should use NoActionBar theme in your app. 您应该在应用程序中使用NoActionBar主题。 And of course add "adjustResize" in manifest in place where you activity is :) 当然,在清单中您活动所在的位置添加“ adjustResize” :)

In the Android Manifest, give the property android:windowSoftInputMode="adjustResize" . 在Android清单中,为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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM