0

Possible Duplicate:
FullScreen Activity in android?

I'm developing an Android Game and I need to know how to set the application to full screen and how to set the app to Landscape mode only. How should I do this?

Community
  • 1
  • 1
user1956475
  • 45
  • 1
  • 6

4 Answers4

2

In your manifest set the following theme to your activity to make it fullscreen.

android:theme="@android:style/Theme.Black.NoTitleBar"

And set this to make it fixed to landscape orientation

android:screenOrientation="landscape"
Sudarshan Bhat
  • 3,772
  • 2
  • 26
  • 53
0

Inside your xml for the activity place the following:

 android:screenOrientation="lands cape"

 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
turnt
  • 3,235
  • 5
  • 23
  • 39
0

1. Manifest way - For whole Application

you should specify this feature in your Manifest.xml - <application>

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:screenOrientation="landscape"

2. Inside your code - For specific Activity

in your onCreate method work both these approaches:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

or

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Community
  • 1
  • 1
Vikalp Patel
  • 10,669
  • 6
  • 61
  • 96
0

Add this line in AndroidManifest.xml

<activity android:name=".FullScreen" android:label="@string/app_title_home"  android:screenOrientation="landscape" />

Edit your activity class like this.

public class FullScreen extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.main);
    }
}
Ajay S
  • 48,003
  • 27
  • 91
  • 111