Is there any way to find out why the soft keyboard show up in one of my views ?
The app is quite big and it's not obvious why the keyboard gets enabled. Do you know any way to debug that?
You can use the following line of code in the activity's onCreate method to make sure the keyboard only pops up when a user clicks into an EditText
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
or
android:windowSoftInputMode="stateHidden"
In the manifest.
Related
I have two EditText views and one ImageView. My goal is to hide the ImageView when i am showing the keyboard (When the user have clicked on one of the EditText fields)
Then show the imageView again when the user have unfocused the EditText field or the keyboard is not visible anymore.
I have tried tons of different ways to do this. But nothing really works as intended. Do you guys have any idea how i could achieve this
Have you tried to detect if the keyboard is opened ? How do I Detect if Software Keyboard is Visible on Android Device?
Make debug and when is opened try to hide image . imageview.setvisibility (GONE)
if it does not work you can try to change layout
Make 2 layouts and switch visibility if the keyboard is open /closed
You can add a OnFocusChangeListener to the EditText,when you click the EditText,it will get focus,and then you can hide the ImageView.
<activity android:name="SearchResultsActivity"
android:windowSoftInputMode="adjustPan"/>
adjustPan:
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.
regards! :)
You can do one thing, place UIView-> UIImageView -> UITextfield1-> UITextField2.Handle the UIImageView hiding state in textfield delegates which are Begin and End editing delegate methods
Is there a way to prevent the softkeyboard to show up in a WebView? My app is attached to a scanner which simulates keyboard entry (that works so far), so the softkeyboard is only annoying when it occupies the screen.
The Nullkeyboard from the Playstore does the trick, but in certain cases I would like to enable the keyboard again.
If it helps, I can control the content of the webpage being shown. Would like to avoid programming a full input method.
In your manifest, on the activity, use android:windowSoftInputMode="stateAlwaysHidden" and the soft keyboard should never be displayed.
I have an edittext in my activity, and on activity and on create view
I am setting the focus on the activity. while setting focus, I am also
trying to show the keyboard. It works on some devices, but on others it
just doesn't show.
I tried to step through the code and found that the view is not created, when
the show keyboard is called. Maybe that is the reason.
I am not sure what the problem is. Is there a way to make sure, that if a edit text
is in focus, the keyboard shows up on app start.
Thanks,
You can try to show the Soft Keyboard by calling the following line during onCreate:
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
I hope that helps.
In your AndroidManifest.xml, add this attribute to the <activity> tag for the Activity you want the keyboard shown:
android:windowSoftInputMode="stateVisible"
I have a single activity class and it has a two EditTexts on the screen. When the activity launches the keyboard launches with it. Why is this? I did not request enter anything yet into the edit box. Why does it do this? And how can I get rid of this behavior?
Try setting your stateHidden in the manifest file for the activity:
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
and this might be helpful:
How to keep soft keyboard from opening on activity launch in Android?
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Same problem that I've read on other posts. I don't want the soft keyboard to pop up when the Activity loads. The above code snippet works, however my View no longer scrolls up so that the User can still see the EditText.
It scrolls without this line of code. Any ideas?
Set right attribute on your activity in manifest
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft