24

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.

5
  • did you check adjustPan or adjustResize in manifest Commented Feb 20, 2014 at 11:51
  • 1
    Yes I did, but then the login button gets cutoff a little Commented Feb 20, 2014 at 11:52
  • 1
    <activity android:windowSoftInputMode="adjustPan" Commented Dec 11, 2015 at 7:04
  • I am in the same boat as you and it has been bugging me for days. Have you found any solution for this? Commented Apr 25, 2016 at 6:03
  • Possible duplicate of Android soft keyboard covers edittext field Commented Aug 28, 2017 at 22:45

3 Answers 3

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

Sign up to request clarification or add additional context in comments.

3 Comments

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 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.)
@Alexander check .I think you can use these solutions
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> 

2 Comments

adjustPan as well as adjustResize will not work because the login button gets cutoff a little
try adjustResize|adjustPan
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.

1 Comment

"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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.