I have an Activity (single) and if I flip the device I can see only the half of the Activity. I have two EditText and a Button and I can't reach them because I can't swipe to bottom. If I flip back the device everything is ok.
Is there any method that I must call to can swipe?
Use ScrollView as Niek said.
2.Set Fixed Orientation if you Haven't designed for the LandScape mode,(i.e Either potrait or landscape)
You can set your fixed orientation in your Manifest file like this
android:screenOrientation="portrait" (You can apply this to your activity as well as for the application whole)
Use a ScrollView to wrap your layout.
Related
I have an animation between two fragments. The second fragment will bring up a keyboard. As the keyboard will cover parts of the screen, I manually need to but a spacer view in there to adjust my view. Using android:windowSoftInputMode="adjustResize" will result in my transition-animation to be super laggy. Using adjustNothing on the other hand will make it smooth.
So is there any way to get the keyboard height without using adjustResize?
EDIT:
My question is different to f.e. Is there any way in android to get the height of virtual keyboard of device as I can't add adjustResize
When the soft keyboard shows up, I only want the Views inside the most outer layout to be pushed up. The reason is because the most outer layout has a background which gets squished when the keyboard shows up. I want the background to be unaffected.
How do I do this?
I had the same issue when developing a chat app. What worked for me was setting the background on the window and not in the layout. Like this:
getActivity().getWindow().setBackgroundDrawableResource(R.drawable.background_hd);
Have you tried setting the following:
android:windowSoftInputMode="adjustResize"
in the <activity../> tag in AndroidManifest?
This should adjust the size of your layout in this activity when the keyboard is displayed.
There are plenty of more implementations you can use to handle different states RE the documentation:
http://developer.android.com/guide/topics/manifest/activity-element.html
I wonder and not getting how facebook manages to fit the layout on all screen sizes by removing the padding or margins as shown below in landscape mode and open keyboard mode.
If anyone has implemented the same or getting the logic behind it please let me know.
If you place the elements inside a ScrollView, they will automatically move up when the keyboard is open. You must also have android:windowSoftInputMode="adjustResize" in your AndroidManifest.xml file for the appropriate Activity.
In my Activity I have an EditText on the ActionBar with android:imeOptions="actionDone".
Under it I have a Fragment.
It works great on vertical orientation (great = as expected).
However on horizontal orientation the only thing I can see is a big EditText with a big button Done and keyboard.
It is not styled, I can't see the ActionBar nor my Fragment.
Is this the standard behavior in Android to show an EditText like that?
Can I force Android not to do this?
Yes, it is standard. It is called extract mode.
You can disable it using:
mEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
or
android:imeOptions="actionDone|flagNoExtractUi"
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+).