I have an app with ListView in it and I added search functionality to it. When I press on EditText and it opens keyboard, it pushes everything in the layout along with it.
Normal layout:
With keyboard:
As you can see; the ad, play button, seekbar are all pushed up along with the keyboard, but I don't want that. Is there a way I can avoid this?
I tried adding this to Manifest file:
android:windowSoftInputMode="stateUnchanged"
But that doesn't work.
You probably want to use "adjustPan".
From the documentation:
The activity's main window is not resized to make room for the soft
keyboard. Rather, the contents of the window are automatically panned
so that the current focus is never obscured by the keyboard and users
can always see what they are typing. This is generally less desirable
than resizing, because the user may need to close the soft keyboard to
get at and interact with obscured parts of the window.
Related
Is there anyway to dismiss the iPhone keyboard or disable it from popping up at all while Appium tests are being run?
driver.hideKeyboard() doesn't work, half the time a "DONE" or "RETURN" button isn't present and I can't just tap randomly on the screen because I can not guarantee that the code won't accidentally tap a link or active element.
I don't understand why it doesn't just function like on Android and just never display the keyboard when using driver.sendKeys().
I've noticed the same and did a workaround by doing it like an actual user and clicking on the hide keyboard button. You might want to add a check to only click if the element is visible to avoid trying to close the keyboard when it's not there.
driver.findElement(By.xpath("your_keyboard_close_button")).click();
When the keyboard in my application is open, the BottomNavigationView is attached to the keyboard. So I added in AndroidManifest android: windowSoftInputMode = "adjustPan" but now the keyboard covers the bottom of the content. That is, ScrollView cannot change the maximum height to the keyboard. As if the fragment does not see when the keyboard is turned on. How can I show the keyboard so that the fragment adapts and the BottomNavigationView disappears. Help me pls.
Nothing can change the maximum height of the keyboard. The keyboard itself gets to decide that. There are only 2 actions you can take when the keyboard appears- pan or resize. The first will scroll your app so that the cursor appears on screen. The second will relayout your app in the space above the keyboard. Which if your screen is designed to can shrink extra space to make more stuff fit.
There is no option to hide certain views when the keyboard appears. There are hacks you can find that try to detect when the keyboard appears, but they all have flaws and ways they break. Android isn't set up to enable you to know when the keyboard is onscreen. You can try one of those, but more realistically you're going to live with this behavior.
I would like to check if the soft keyboard is visible at a certain moment. I'm not talking about listening to its open/close event. It is the moment after the keyboard is already fully opened and before the keyboard starts to close. So whether it is on the screen now or not.
I did google around and all I got is about how to listen to the keyboard's open/close event.
I've just found a workaround solution in "Are you open?" section in the following link.
How to detect if the android keyboard is open
It's basically comparison between the current heights of root view and visible frame.
I'm trying to make an overlay on the screen using JavaFX and an issue I'm having is that whenever my overlay pops up, it steals focus from whichever program I'm currently in. The issue with this is that my overlay allows the user to simulate keyboard key presses using the robot class (like an on-screen keyboard) and without keeping the focus in the original window, the typed characters have nowhere to go. I've tried setting the modality to none, but that's also the default option and it doesn't seem to be doing anything. Would putting my JavaFX scene in a JFrame work or is there some better way to do it only in JavaFX?
Try this
when focused -> compute what you want to
then call Stage.toBack(); //the currently focused window prior to yours will gain focus back
My activity A is a game and it does some background operations. When I press a button in the contextual menu, I want to pop up a "small window/dialog/subactivity" (lets call it B) that appears on top of activity A and displays some data about those background operations. But I need to keep the focus on the activity A in order to continue interacting with it (playing the game).
In essence, I want to be able to see the data display by B while playing the game.
I'm not really sure how to implement this. After reading the documentation I have the next conclusions:
I know that I can't use Dialogs because the have the focus. Is it possible to avoid this?
Using a subactivity with a Dialog theme it's another option that looks tempting...but I believe that the subactivity has the focus. Ditto.
My last option is to try to add a LinearLayout with my data to the main Layout, "sharing/splitting" the screen. It's not pretty, but at least I know that this is possible. What I don't like about this approach is that I use the width and height of the screen.
Any suggestions? Solutions?
PS: I found some this thread here that are very related to my question:
Android ==> Sub Activity?
Create an Activity with style Theme.Dialog. This is a normal activity which looks like a dialog, while being modeless and accepting events.
Additional catch is in setting WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL and resetting WindowManager.LayoutParams.FLAG_DIM_BEHIND.
See this answer for complete example: timed modeless dialog
Why not use a FrameLayout that is apart of your Activity? Just ensure that this View has a higher z index (make sure you declare it last in your XML layout or create it at runtime). That way you never leave your Activity.