Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making an Android app run full screen and landscape

I have seen certain apps, especially most of the games (Eg. Angry Birds, Temple Run etc) run fullscreen and in landscape mode when launched. Their orientation never changes and they never exit fullscreen when the screen is touched. How its done? What properties do I need to change or code?

like image 831
Sunit Prasad Avatar asked Jan 06 '13 12:01

Sunit Prasad


People also ask

How do I force an app to run in landscape Android?

Setting the app upWhen on the main screen, under the orientation section, you will see a number of options like 'Auto-rotate OFF', 'Auto-rotate ON', 'Forced Portrait' and 'Forced Landscape'. As the names suggest, you can use these buttons as one-tap shortcuts to toggle the orientation of your device.

How do I keep Android apps from portrait only?

If you want to develop an application in portrait mode, add screenOrientation inside application tag. In the above result it is showing only portrait mode. now turn your device it not going to change the view according to orientation.

How do I force orientation on Android?

Use Rotation Control to force screen orientation of Android devices. Once you've installed, open the app and just tap to turn it on. You can even start it when you restart your phone. This will help you when you don't want to open the again and again after every reboot.


1 Answers

If you prefer to use XML, you can change the AndroidManifest.xml:

<activity android:name="..."
    android:screenOrientation="landscape"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

</activity>

If you are targetting Android SDK 9 or above, you can use sensorLandscape instead of landscape which will mean that the screen will look the correct way up on both normal landscape orientation and reverse landscape orientation.

like image 200
Tom Leese Avatar answered Sep 22 '22 13:09

Tom Leese