I am using viewpager with full screen theme.
but facing a problem that my softkeyboard hides the button when edittext in focus.
want to put some margin between EditText and Softkeyboard.
Tried all the things but nothing worked.
Please help me.
How to add margin between EditText and Soft Keyboard?
this is the questions link which i've asked.
In the activity entry in your AndroidManifest try putting:
android:windowSoftInputMode:adjustPan, this means when the keyboard comes up it will adjust the view behind it to move up so it is not obscured by the keyboard.
In the EditText you can also try adding a paddingBottom to adjust the gap between the keyboard and the bottom of the EditText.
In my case I had a custom background for the EditText, which was no longer looking OK. Because the parent view for me was ConstraintLayout I added another View element behind the EditText with:
app:layout_constraintEnd_toEndOf="#id/view_chat_history_send_text"
app:layout_constraintStart_toStartOf="#id/view_chat_history_send_text"
app:layout_constraintTop_toTopOf="#id/view_chat_history_send_text"
android:layout_marginBottom="#dimen/margin_normal"
Note: here view_chat_history_send_text is the EditText. And then I added a layout_marginBottom of the same margin as the paddingBottom of the EditText.
This means, when the EditText grows the background view grows as well, but it still maintains the gap between the keyboard and the EditText bottom.
I applied above methods which worked for me was
Set android:windowSoftInputMode on the Activity to "adjustPan"
than I added the padding to the edittext with gravity bottom
and it works like charm.
Related
There is a screen with a fixed header(AppBarLayout) and LinearLayout(with four TextView's and a Button at bottom). When keyboard is opened text field gets hidden. I want only linear layout to be scrollable. Have tried with ScrollView, adjustResize in manifest & i am not using
"Theme.Holo.Light.NoActionBar.Fullscreen"
Nothing worked out. How to achieve the same.
You can use the following code to push the layout up when keyboard is shown.
getActivity.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
There is a CardView with an EditText and when the keyboard opens, it is placed right below the EditText. But as shown below, the keyboard is too close to the EditText and it is hard to press the "send" button because there is not enough space.
EditText:
EditText with focus:
Is there any way to show the keyboard after the end of the CardView?
I saw some similar questions here, but none of them provide a solution that I need. Some answers suggest to set a paddingBotton in EditText, but that is not what I want. I don't want space, I want to show the end of the CardView too.
Note that I don't want to resize the layout, so "adjustResize" is not the solution and I'm already using "adjustPan" in AndroidManifest.xml
<activity
...
android:windowSoftInputMode="adjustPan" />
Any thoughts?
If you are using scrollview. you can do one thing is to scroll your scrollview as your requirement
Please refer below code for example
ScrollView sv =(ScrollView)findViewById(R.id.scrl);
sv.scrollTo(0, sv.getBottom());
or
sv.fullScroll(View.FOCUS_DOWN);
this action you can perform on soft input of Enter key.
There is also one other solution you can hide the suggestion of keyboard by giving
android:inputType="textNoSuggestions"
I have an ImageView aligned on bottom of my layout contains "footer" of my app. Layout contains also ad EditText. Now when i tap on EditText and keyboard appear, it doesn't go over my footer, but footer get moved on above keyboard. There's a way to lock the imageView and get keyboard go over ImageView?
Add this in your activity tag in the manifest android:windowSoftInputMode="stateHidden|adjustPan"
Yes. Have a look at android:windowSoftInputMode manifest attribute. Specifically, consider using adjustPan there.
I have an EditText using a background with a big height, when I click on my EditText, the screen shifts up to show the soft keyboard, but not the entire EditText stays visible. The bottom part of the Edit Text background disappears because the soft keyboard goes up in it.
I need that my screen shifts up a little more! How could I do that?
Tks,
I think its better to use a ScrollView.
Using this will shift the entire screen up.
Try it out once
Create a empty layout and put it at the bottom of the screen by property align parent bottom set to true.
Now set your edittext above it. Add property layout_above and pass the id of the layout.
Now in the manifest, add screensize to config changes attribute for that activity or in the application tag
Currently, when I select an EditText in my application and the keyboard appears, the layout/view automatically adjusts to show the full EditText just above the keyboard, if it would have been below, otherwise.
Is there any way to set a different View to be just above the keyboard when it shows up? I have a button just below the EditText and I would like to have it just above the keyboard, if possible.
put that button and EditText into a layout and make that layout gravity top, or in Button's attributes add this line
android:layout_below="id of edittext"
Hope these help.