Reputation: 368
I've already made a good search on this but i never find a working solution so that's why i post here.
I have an android application where there is a TableLayout with some View in it (EditText, TextView and CheckBox).
I implemented my own keyboard so i can control the information entered by the user.
My TableLayout is in a ScrollView because the TableLayout can have many lines.
The problem i have is when my keyboard showes up, it hides the EditText focused. Usually android push the EditText up to make it visible but not in my case. How can I solve this?
Upvotes: 1
Views: 345
Reputation: 479
I had the same problem with custom keyboard using KeyboardView and I solved it by setting item selection with short delay.
public boolean isCustomKeyboardVisible() {
return keyboardView.getVisibility() == View.VISIBLE;
}
public void showCustomKeyboard() {
if (!isCustomKeyboardVisible()) {
keyboardView.setVisibility(View.VISIBLE);
//Calling my custom listener
onKeyboardVisibilityChanged.visibilityChanged(true);
listView.postDelayed(new Runnable() {
@Override
public void run() {
listView.setSelection(position);
}
}, 50);
}
}
public void hideCustomKeyboard() {
if (isCustomKeyboardVisible()) {
keyboardView.setVisibility(View.GONE);
onKeyboardVisibilityChanged.visibilityChanged(false);
}
}
Upvotes: 0
Reputation: 368
always have the same problem. I find out that the windowsSoftInputMode="adjustPan" or others options doesn't work with custom keyboard.
My CustomKeyboard is a class that implements a KeyboardView, link an xml to this keyboardView and has 2 methods to show or hide it...
If someone has a idea why the adjustPan doesn't work with custom keyboards, please let met know!
Tristan
Upvotes: 0
Reputation: 8747
Have you tried to add the attribute windowSoftInputMode
to your manifest file:
android:windowSoftInputMode="adjustResize"
or
android:windowSoftInputMode="adjustPan"
within the <activity>
tag.
Upvotes: 1