简体   繁体   中英

Android soft keyboard hides button

I do have a simple login view like shown below.

If any EditText gains focus, the keyboard will be shown (soft). The red dashed line should outline this behavior:

键盘

What I need is, that the Buttons at the bottom (Signup & Help) are invisible while Keyboard is showing. The bottom end of the login button should be over the keyboard, so that both EditTexts and the Login Button are visible.

At best half of the Logo should be visible if possible (depending on screen size)

It would be perfectly fine to define an extra layout xml like "keyboard is visible" if that's possible.

1) ScrollView as parent layout so that it can be scrolled by user.

2) using only adjustResize

3) Use software keyboard show/hide event to have more control. You can set visibility of the layout below login button with View.GONE while keyboard is visibe.

extra:

Check Specifying the Input Method Type . Next and Done actions for convenience of user

Do somthing like dis. Here "android:name" is your activity.

<activity
            android:name="com.example.tryitonjewelry.EnterStoreRegisterNew"
            android:label="@string/title_activity_enter_store_register_new"
            android:screenOrientation="portrait" 
            android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.ENTERSTOREREGISTERNEW" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

You can manage it by few steps. When KeyBoard popup then do the following steps or you can wrap these in a method...

  1. Get the window height.
  2. Determine the keyboard height.
  3. Scroll your view above the keyboard height using scrollTo() method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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