How can I always display the virtual keyboard in landscape mode in startup of the activity? and this keyboard doesn't fill the entire screen so I can display some views above the keyboard. The shape should be like when you open the android web browser in landscape mode then go to an input field. The keyboard doesn't fill the entire screen.
editText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); should solve the problem
For which ever activity you want to display the keyboard only in landscape mode.
Try this in your manifest..
<activity android:screenOrientation="landscape" android:configChanges="orientation|keyboard" android:name="sActivity">
Related
Is there a way to control where the soft keyboard appears on the screen? Assuming it takes the whole width, I would like to be able to specify a height so that the keyboard shows on the top half of the screen. Is this possible?
Currently I'm just showing the keyboard using SoftInputMode in the manifest file.
android:windowSoftInputMode="stateVisible"
Please try using android:windowSoftInputMode="stateAlwaysHidden" attribute and also apply this attribute in the previous activity of current activity in which the keyboard is opened.
I have an activity with "portrait" orientation in AndroidManifest.xml.
When I start it from lock screen in landscape orientation, it appear with landscape for 1 second, and then change to portrait. The delay happens even if it's an blank activity (no view, no task).
Tell me how to avoid this delay. Remove transition effect, rotation effect? I know it could be device performance, but still want to fix this.
If you always wants to run your app in landscape mode than use this code in Manifest file for all activity
<activity
android:name=".yourAcitvity"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize"
/>
That't the default behavior of Android, you can verify this issue using system apps. For ex: open the Android's default messenger, and turn it to landscape and lock the phone, now unlock it and you can see the messenger has re aligned to portrait, that's because the home screen is set to portrait by default. In order to show the home screen the system aligns the device to portrait again.
Running into a strange problem.
When I'm on portrait and have the keyboard visible and rotate to landscape, the keyboard is dismissed (with or without text in the EditText). The text is also retained on rotation.
When I'm on landscape and have the keyboard visible and rotate to portrait, the keyboard continues to be visible on portrait.
Any idea what could be going wrong? I'm not handling configChanges myself and I don't intend to.
I also tried using stateUnchanged | adjustResize in the XML and that did not change anything.
I am enabling orientation change in focusChangeListener of an edittext in my app.
It is working fine, but the issue is if the user flips the keyboard to landscape mode keyboard disappears.
It will come up only if user tap on edittext again or change orientation to portrait mode.
I need to display keyboard in landscape mode without touching the edittext.
Please help me.
Generally, its a bad idea to mess with the default IME behavior because there are devices out there with hardware keyboards.
Now, that you have been warned, listen for the orientation change and if the keyboard was visible before the change and there is no hardware keyboard on the device, show the keyboard manually.
Try using android:configChanges="orientation" into your manifest class.
<activity
android:name=".classname"
android:configChanges="keyboardHidden|orientation"
>
if works then accept it.
I'm using an android search dialog in my app, and it works fine in Portrait orientation. But as soon as you flip to landscape orientation the searchpage xml appears to be covered by a large white dialog box. If you do a search, the box is still there, and you hit the back button on the device or emulator, the large white box slides away and there are your search results. It seems like somehere in the code a layout width is set to fill_parent or something. I've looked around for a solution and someone suggested adding android:imeOptions="flagNoExtractUi" to seachable.xml in the xml folder, but that doesn't seem to have any effect.
I've discovered that it's the onSearchRequested(); method that is throwing up that white box that fills the screen. And it also may have something to do with the fact that the software keyboard isn't called when in landscape, vertical orientation.
You could create your own Dialog in the form of an Activity. You do that like this:
<activity
android:theme="#android:style/Theme.Dialog"
android:configChanges="keyboardHidden|orientation|screenSize"
android:name="ExampleActivity" >
</activity>
This Activity can of course be arranged any way you like via the XML. This way, you can gracefully handle the change from portrait to landscape.
Note: You only need the "screenSize" attribute if you are using ICS (14+).