How to show a fragment when soft keyboard is on the screen? - android

As you know when the soft keyboard is on the screen you can see a part of the main layout.How can I fill this part with a fragment? This fragment appears when the soft keyboard is on and it will gone with the soft keyboard.The main problem is how to evaluate the size and location of the fragment in different size and resolution.
I want to put an ImageIcon, a big EditText that shows what you have typed and a confirm button. Absolutely my problem is only to manage this fragment not the content of it.

Related

Android | How to hide BottomNavigation even if windowSoftInputMode is set to 'adjustResize'?

I have an activity with BottomNavigation. If the user needs to click on the submit button soft keyboard hides it. Then he again needs to press the back button to see the submit button. In this case, I used windowSoftInputMode='adjustResize' so that the screen gets resized automatically and the user can scroll up and click on the submit button.
But, I have BottomNavigation too, windowSoftInputMode='adjustResize' makes BottomNavigation float above the soft keyboard. Can anyone suggest a better solution? Any help will be appreciated. Thanks
Thats tricky issue... You have two options in here:
Keep 'adjustResize' and hide BottomNavigation view when keyboard pops up (e.g. simply setVisiblity?)
Change to e.g. 'adjustPan' (or any other) preventing keyboard resizing app and add bottom padding with height of keyboard for whole content container. BottomNavigation will stay hidden under keyboard, but padding will allow scrolling to Submit button
In both cases you need to detect open/close keyboard, in second case you will also need keyboard height measuring. IN HERE and HERE you have big SO topics about this case, check out answers and comments, and pick proper resolution for your purposes

AdjustResize does not work after dismissing keyboard by clicking outside keyboard

I have a WebView (within a Fragment within a ViewPager with SlidingTabLayout).
When using the WebView to type, I want the layout to resize to make sure the input is visible.
When I click a text input in the WebView, the softkeyboard appears and the layout resizes. I'm able to enter my text and submit using the softkeyboard's return button or cancel input using the back button. After this, the keyboard disappears and the layout resizes back. Correct AdjustResize behavior.
However, when dismissing the keyboard by clicking outside the Softkeyboard (e.g. when entering a query in Google and pressing the Search button in the WebView) the keyboards hides and it takes about 2-3 seconds for the layout to resize (leaving a blank space for 2-3 seconds at the bottom of my layout). After that, when selecting the textinput, the keyboard overlays the WebView (adjustPan).
How can I make sure that when dismissing the keyboard by pressing the WebView, adjustResize behavior is maintained.
I've tried re-setting AdjustResize (e.g. from onTouch) but this has no effect:
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
I've also tried the following solution but this gives no change.
In addition, I've think this is probably not a focus issue (since the keyboard does appear, and the webview does respond). And I do ask focus from my View:
webView.setFocusable(true);
webView.setFocusableInTouchMode(true);
It turned out to be that when you perform layout translations on the WebView or if the WebView's layout is changed indirectly (e.g. when resizing an element above the WebView in a RelativeLayout that causes the WeView to also be resized) showing and hiding the keyboard can cause some strange behavior:
AdjustResize behavior can be lost (as indicated in the question)
WebView resize's after keyboard can take longer then normal.
WebView's performance decreases
What solved this issue for me, was to prevent layout changes in the WebView in any way (layout reload upon rotation does not appear to cause this). In my case I was showing and hiding the Toolbar causing the WebView to resize (and fill the screen).

Blank space when soft-keyboard opens in Android

I need to use
windowSoftInputMode="adjustReszize"
for detecting Soft Keyboard changes i.e when it opens/closes.
My problem is that when I do this I see a blank space for a split second as the view is first re-sized and then the keyboard opens.
Is there any way to avoid this other then adding a background image to the window?

soft keyboard full screen in android application

I have an application, where I have a list view, and list view is made upon custom adapter. I have made a suggestive search on list view. My problem is that, when I am about to type something in edit text search pan; then soft keyboard pop up gets full length by width and height in the screen, so I have no option to see whether my list view is getting changed on text change in edit text. I am being enable to see search result until I press done button in soft keyboard. I want soft keyboard pop up just pops up half the screen of my application so that I can see my listview data changes on text change given in edit text. Is there any solution related to my issue???
Add to your EditText the attribute android:imeOptions="flagNoExtractUi". This will prevent the soft keyboard to take full-screen size.
Check this answer: Disabling the fullscreen editing view for soft keyboard input in landscape?

Android keyboard hides itself, showing blank space below, after coming back from screensaver

I am working on an android app and really enjoying it too. But today, I got stuck on a small problem with soft keyboard.
I have an EditText at the bottom of the screen and when user clicks on it a keyboard pops up ,resizing the entire view to show the EditText above keyboard, which is as it should be. But if user doesn't do anything for sometime, phone sleeps and screen gets locked with the keyboard still present in the screen. When phone comes back after sleep, the keyboard seems to hide itself, leaving my views in a resized state. A blank space is shown where the keyboard has been present..I would be happy if
The keyboard remains there after
coming back from sleep..
Let the keyboard hide,but my views
should go back to original size, ie
without any blank space..
What can I do to achieve any of these?

Categories

Resources