In my Android app, I'd like to slide a custom view up from the bottom of the screen while the keyboard is onscreen, either overlaying the keyboard or temporarily animating it out of the way. Ideally the view would be the same size as the keyboard. The user would briefly reference with the custom view, then tap to dismiss it, bringing back the keyboard.
How would I go about doing this? Thanks.
Related
I have a requirement to show an editText on top of keyboard when the keyboard opens. But at the same time I have to hide the bottom tab navigation view on my fragment screen. It should be behind the keyboard.
I have tried multiple combinations for android:windowSoftInputMode but in some cases, either the EditTexts is not displayed or the entire screen is showing on top of keyboard.
Is there a way to keep the screen view as it is and open the keyboard with EditText on top of it.
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
I use a Modal Bottom Sheet to allow the user to enter some text and create Decisions or Tasks.
Some users want to close the keyboard and they tap outside of the Bottom Sheet and close it. This is a big issue because all the text is lost.
The material design documentation states that it can be dismissed when the outside is touched but this doesn't work for me.
I want to intercept the onOutsideClick event and check the keyboard's state:
Keyboard shown: Close the soft keyboard
Keyboard hidden: Dismiss the Bottom Sheet
Should I use a custom BottomSheetBehavior or can I Override some dialog methods?
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).
I am using Fragment view in my application. And along with that at the top view I am using Surface view. I am opening soft keyboard on click of button. And then whatever I will write it must be showing on surface view. All thing working fine. But the issue is when I dismiss the soft keyboard one black screen will showing on background of my surface view.
If I used surfaceview.setBackgroundColor(Color.TRANSPRENT) then it will affected on my cover flow images. My images are not change frequently. It will affected when I open soft keyboard.
So I am not able to understand that how can I solve this problem? Is there any other solution to remove that Black screen?
Waiting for reply.