I have searched and searched and there I can't find a suitable and working answer for how to get the default keyboard height on Android when you are not resizing the view.
My activity needs to have this:
android:windowSoftInputMode="adjustNothing"
So how do I know the height of the keyboard when it is displaying?
In fact there's no way to do this, and there's no 'default height' kinda value. One idea is that when showing keyboars at first time, measure your apps resized height value, and try compare this height with normal status value. Try save this value and use them.
Related
I'm writing my first Android-App. The App should solve Sudokus for the user.
So the interface should look like the typical Sudoku-Layout with some Buttons down below. For the number-fields i just used EditTexts.
At first i used a ContrainsLayout. That worked fine so far but the problem is that the editTexts on the right are not visible anymore if the screen of the user is too small.
I use a fixed height and width of 40dp for the editTexts and a constraint of 1dp between the editTexts.
But i cant get it to work that way on different screen sizes.
So i used the GridLayout. There problem here is that i cant get the whole thing to be in the center. And besides that i dont know if its possible to stretch a TEXTview over multiple rows?! I would need this to show the errorText in case the sudoku isnt solvable.
I hope someone can help me out or at least give me some ideas :)
Thanks in advance
If you want the same result for different screen sizes the recommendation is constraint layout but the reason you don't have the same result is that you used hard coded width and height and on different sizes you need to change the size that you hard coded.
The best thing to do is to make separate xml files for screen sizes
for more info you can see here: how to have different sizes supported
I am developing an accessibility service on android and I want to check the space between on-screen elements. Currently I am already using AccessibilityNodeInfo and its getBoundsInScreen() method to read the touch target size of clicked elements.
Do you know if there is a way to retrieve the margin of an element?
There is not. Anything that you came up with would be a hack.
You could compare the on screen coordinates of elements. But, then you're not going to get a "margin" just the space between them. There is no way to get a "margin" property.
In my AIR mobile application I am trying to resize my application when the softkeyboard is activated so that the bottom of my application will not be covered by the keyboard. From what I have read this is suppose to be the default behavior but I have never been able to get it to work and I have tried everything I have found online, instead the keyboard overlays ontop of the application.
I then decided I would resize my application myself based on the height and y position of the softkeyboard only to find out that the built in AIR methods for determining the height and y position of the keyboard are not correct (YAY). I even tried using a 3rd party ANE for determining the screen height by FreshPlanet and their code does not always return correct values either. I feel like this shouldn't be that hard to figure out but I am stuck. Please help!
TLDR:
How can I resize my application to be the remaining screen space when the softkeyboard is activated?
What renderMode are you using? (in manifest.xml) I found that only cpu is working to get the correct keyboard height.
Also try to set softKeyboardBehavior to none: <softKeyboardBehavior>none</softKeyboardBehavior>
First, it's not a simple question like this quest or this quest.
I have to get soft keyboard height in my project. I used to get device screen height and subtraction it by out app root view height. However, it work correctly until my test using keyboard suggestion. Unfortunately for me, my solution did not right in this case. The number I got alway bigger than the soft keyboard height. I tried to google but fail.
Here's my picture:
I'm trying to solve this problem in ages but i can't find a solution:
I need to know how much height a webview with some HTML text in it will take in a LinearLayout, if the space occupied doesen't go over screen size i must add another webview with other HTML text in it. I can't figure out how to do it, i tried to call
measure() but it will give me 0 whatever measurespec i try to use.
Someone knows how to do it?
Thanks in advance.