Alexander
Alexander

Reputation: 7238

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:

Keyboard

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.

Upvotes: 24

Views: 18838

Answers (3)

qwr
qwr

Reputation: 3670

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

Upvotes: 7

Hamid Shatu
Hamid Shatu

Reputation: 9700

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.

Upvotes: 1

Mayank Saini
Mayank Saini

Reputation: 3017

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>

Upvotes: 3

Related Questions