Frage

I have a register activity with the logo and many EditTexts, the problem is that when I tried to fill the editTexts, the softkeyboard is shown and it hides the most part of the Edittexts, I tried with: android:windowSoftInputMode="adjustResize" but it doesn't work, I think, hidding the logo would be the solution, is there anyway to hide some ImageView when the keyboard is shown and show it again when the keyboard's hide?

These are the reference images:

This is the activity initially

all EditTexts

And this is how it looks with the keyboard

KeyboarShown

War es hilfreich?

Lösung

To answer your question (hiding image when keyboard pops up), use the following piece of code to hide/unhide the image.

edit_Text.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
    if(hasFocus){
        image_view.setVisibility(View.GONE);
    }else {
        image_view.setVisibility(View.VISIBLE);
    }
   }
});

You can add this code on all the edittexts. But the best way to handle your situation would be to add all your content into a ScrollView so that when you use adjustResize it will automatically scroll up your views and the user can scroll to whichever fields he wants to go and he can also see the image.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top