I have a little issue with the keyboard on my numberpicker.
It's kinda hard to explain in words so here are some screenshots:
When I click on the numberpicker the keyboard shows up:
When I click on the next button (in this case the 'Volg' button) I implemented that it should focus the next edittext.
But as you can see, the screen shifts a little to the top.
This is not a huge problem but it's kinda annoying.
What can cause this, or how can I fix this ?
Edit: the layout is a scrollview.
try this
In your manifest file under activity tag use attribute
android:windowSoftInputMode="stateUnchanged"
Related
I'm writing a custom EditText that will have functionalities to bold/italic/underline/lists .... for Android
It's working so far so good but I've a problem that when a user clicking on a Button (for styling bold/italic...), the user will lose focus on the EditText.
Anyone has any ideas how to prevent the button taking focus from the EditText?
Thanks :)
The easiest thing to do would be to have the onClickListener of those buttons refocus the edit text as their last instruction.
You can also try putting focusable=false (and focusableInTouchMode=false) on the buttons. That may work, I'm not sure if focus is removed from the edit text when the screen is touched or when another item receives focus, which is subtly but important difference here. It would also slightly change any drawables on the button that use focused state.
I am trying to scroll so that the two editText views and the button are all shown when the keyboard opens up. I have already tried adding softInputMode to the xml (I set it to adjustResize). I am now completely lost on how to do this. Anyone have any ideas?
Before the Keyboard shows up
When the keyboard opens
What I want it to look like
Thank you in advance!
There is a CardView with an EditText and when the keyboard opens, it is placed right below the EditText. But as shown below, the keyboard is too close to the EditText and it is hard to press the "send" button because there is not enough space.
EditText:
EditText with focus:
Is there any way to show the keyboard after the end of the CardView?
I saw some similar questions here, but none of them provide a solution that I need. Some answers suggest to set a paddingBotton in EditText, but that is not what I want. I don't want space, I want to show the end of the CardView too.
Note that I don't want to resize the layout, so "adjustResize" is not the solution and I'm already using "adjustPan" in AndroidManifest.xml
<activity
...
android:windowSoftInputMode="adjustPan" />
Any thoughts?
If you are using scrollview. you can do one thing is to scroll your scrollview as your requirement
Please refer below code for example
ScrollView sv =(ScrollView)findViewById(R.id.scrl);
sv.scrollTo(0, sv.getBottom());
or
sv.fullScroll(View.FOCUS_DOWN);
this action you can perform on soft input of Enter key.
There is also one other solution you can hide the suggestion of keyboard by giving
android:inputType="textNoSuggestions"
in my activity I have multiple edit texts, and some animated sliders with buttons beneath them. The problem is when I open a slider and tap on the button, the screen "jumps" back up to the first edit text. How can I stop this from happening? I just want the screen to stay where it was after the button press. Any help will be appreciated.
EDIT/UPDATE I just played around with an iPhone. Would it rather be possible to remove focus from the edit text when the soft keyboard is minimized? (Removing the focus would work in regards to the original question of the screen navigating to the top by its self)
Add the following to your parent layout (i.e. LinearLayout, RelativeLayout, etc.)
android:focusableInTouchMode="true"
I used the following solution. I created a method:
public void clearFocusOnEditText(){
//editText.clearfocus()
}
I then added this method to my ontouch() and onClick() methods. I'm guessing this is not the best solution, but for all intents and purposes it works brilliantly.
add it in your manifest to the activity tag
android:windowSoftInputMode="stateHidden"
In my android application, I have an EditText. When I click in this field, the soft keyboard appears, expanding from the bottom of the screen. It seems to actually modify my layout, pushing contents upwards. When I dismiss the keypad, it retracts, and I see my layout re-expand to take up the space it previously occupied.
Is there a way to get the keyboard to simply appear "on top" of my layout, so that I don't get this somewhat unpleasant relayout animation? The EditText is pinned to the very top of the screen, so I don't have to worry about the keypad hiding it.
Thanks
By default, Android should be using "Pan and Scan", which would work more or less how you described. The keyboard is displayed over your view, and you can scroll your view in the background. If you override the windowInputMode for you Activity, or Android determines that your Activity is resizable (because of the presence of a resizable field... ListView, ScrollViews, etc), it may resize your view instead, and it sounds like that's what you're running into. To force it to Pan and Scan try adding:
android:windowSoftInputMode="adjustPan"
as an attribute to the Activity element in your xml layout.
There's a third option as well. You can specify that when an EditText is selected it will be edited in full screen mode. The other controls in your view will be hidden, the user will be presented with just the keyboard, an EditText control, and optionally some other limited controls. If your EditText doesn't require a lot of context from other elements of your view, it may prevent a cleaner user interface. For more details, see: http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
Add:
android:windowSoftInputMode="adjustResize"
to your activity attr in manifest.xml. Hope it will help.
This questions seems to state a resize is not desirable. I had the same issue, but adding
android:windowSoftInputMode="adjustNothing"
to the manifest file instead solved my problem.