Background
I have the next layout of my activity:
- vertical LinearLayout
- TabHost with a viewPager.
- “status bar” (an imageView/textView) .
Sometimes , in the viewPager , i have a fragment that has an EditText.
The problem
On some screens (like the galaxy mini) , i’ve noticed that when you click on an editText (in order to write into it) , the softkeyboard hides everything , so you are left only with the actionBar , the tabs and the status bar .
What I’ve tried
That’s why i’ve decided to add the next flags on the manifest for this activity :
android:windowSoftInputMode="adjustPan|adjustResize|stateHidden"
This looked like the perfect solution – it hides the action bar , the tabs , and even the status bar when typing , leaving enough space for the editText to show (and also scrolls to it) .
However , testing it on larger screens (like the one of galaxy S3) , this has caused the softKeyboard to cover the editText in the cases where the editText was at the bottom.
I’ve tried to remove the adjustPan flag , which works fine for the large screen , but then on the small screen , even though it has scrolled to the editText , the status bar hides it .
I’ve also tried to set the isScrollContainer to true to some views , hoping that it will cause them to resize upon editing , but it didn’t do anything.
The question
What can i do in order to fix this issue , and handle all kinds of screens ?
I could check the type of the screen and use the appropriate flags programmatically (like here) , but i’m not sure what should be the rules (density/resolution/screen size) , and if i really cover all types of them .
try
android:windowSoftInputMode="adjustPanwith additional functionality
Make another class like this one
now make a custome view of this class as parent in your layout xml file like this
try following code in your java file
myRelativeLayout=(MyRelativeLayout)findViewById(R.int.customRelativeLayout);