22

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.

Alexander
  • 7,178
  • 8
  • 45
  • 75

3 Answers3

7

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

Community
  • 1
  • 1
qwr
  • 3,660
  • 17
  • 29
  • 2
    I dont get the point of using a custom keyboard layout. Why do I need this? I just want to set some views invisible if keyboard is shown and change the scrollviews content offset a little. Isn't there any other way? Can't believe that it is that hard. In iOS it's like 5 lines of code to achieve this behavior... – Alexander Feb 20 '14 at 13:10
  • @Alexander so first add adjustResize atribute. Then inside code keyboard appear with OnTouch (set all editText listens to same OnTouch) and inside OnTouch set visibility of some views that you do not want to show. On back button press (which we assume will hide keyboard) set visibility to visible to show views again. (Note: test by yourself if it is correctly handle all keyboard disappearance.) – qwr Feb 20 '14 at 13:35
  • @Alexander check .I think you can use these solutions – qwr Feb 20 '14 at 13:43
3

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>
Mayank Saini
  • 3,017
  • 24
  • 25
1

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.
Hamid Shatu
  • 9,664
  • 4
  • 30
  • 41
  • 2
    "When the KeyBoard popup" is a little to less information. Is there a keyboard listener or any System Notification like in iOS? Further I read that there is no method to determine the height of the keyboard – Alexander Feb 20 '14 at 12:51