Open keyboard hides the toolbar below fragment - android

I have a fragment that is put in an activity. This fragment consists of a VideoViewand EditTextcomponent.
I dont have a problem showing the video or edit the text. The problem occurs when i try to edit the text. When the text is edited and i close the keyboard. The panning have removed my toolbar.
Or atleast put it behind the fragment from some reason
Anyone know why this is happening? Never seen this problem before

Add android:windowSoftInputMode="adjustResize" in your manifest for your 'activity' element

Related

Android: the soft keyboard is hiding the EditText in fragment

I have a fragment that has some EditTexts that need to be filled by the user. There's a problem that the soft keyboard hides the EditText so that the user cannot see what they're writing. I don't want the user to scroll manually, I want the fragment to adjust so that it fits the keyboard automatically.
IMPORTANT NOTE: I have seen lots of suggestions to add android:windowSoftInputMode="adjustResize"
or android:windowSoftInputMode="adjustPan"in manifest. However, I want this action to be only for a specific fragment and not for all fragments within the activity.
I have tried adding requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
In onCreateView or in onCreate but nothing seems to change.
In my case,
android:windowSoftInputMode="adjustPan" and ScrollView
it's work for Fragment in Activity.

Clicking edit text in fragment causes toolbar to slide off screen

The layout fits perfectly in my fragment normally, but it is a chatting app with an edit text on the bottom of the fragment. If I click the edit text, the fragment gets pushed up and half the fragment goes off the top of the screen.
Reading other answers, I know for activities this issue is resolved by adding the adjustResize option in the xml. Tried adding it for the entire app in my case, but that still didn't fix the issue. Anyone else have this problem?
pictures:

Different WindowSoftInputMode for activity and fragment

I want to achieve the functionality shown in the image. Let me explain the scenario in details.
I have a main activity and several fragments. what I want is when the keyboard is open the activity will remain same (will not resize) but the fragment will change its height and will be shown above the keyboard.
I have tried to do this using android:windowSoftInputMode="adjustResize" and android:windowSoftInputMode="adjustPan" for activity and getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); in onCreateView of the fragment. But its not working properly. I am getting this.
is there any way to solve this?

Keyboard not showing on activity start: Android phones

I have an edittext in my activity, and on activity and on create view
I am setting the focus on the activity. while setting focus, I am also
trying to show the keyboard. It works on some devices, but on others it
just doesn't show.
I tried to step through the code and found that the view is not created, when
the show keyboard is called. Maybe that is the reason.
I am not sure what the problem is. Is there a way to make sure, that if a edit text
is in focus, the keyboard shows up on app start.
Thanks,
You can try to show the Soft Keyboard by calling the following line during onCreate:
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
I hope that helps.
In your AndroidManifest.xml, add this attribute to the <activity> tag for the Activity you want the keyboard shown:
android:windowSoftInputMode="stateVisible"

Supress the Soft Keboard when an activity loads... yet again

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Same problem that I've read on other posts. I don't want the soft keyboard to pop up when the Activity loads. The above code snippet works, however my View no longer scrolls up so that the User can still see the EditText.
It scrolls without this line of code. Any ideas?
Set right attribute on your activity in manifest
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

Categories

Resources