We can achieve full screen view in either of the two ways:
- Include full screen theme in AndroidManifest XML
- Include Window settings in onCreate method of Activity class
Include full screen theme in AndroidManifest XML:
1 | < activity android:name = ".YourClassName" |
2 | android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" > |
Just change YourClassName to the Activity class name ( in our application it is ‘FullScreenExampleActivity’).
Include Window settings in onCreate method of Activity class:
1 | package com.prgguru.android; |
3 | import android.os.Bundle; |
4 | import android.app.Activity; |
5 | import android.view.Window; |
6 | import android.view.WindowManager; |
8 | public class FullScreenExampleActivity extends Activity { |
11 | public void onCreate(Bundle savedInstanceState) { |
12 | super .onCreate(savedInstanceState); |
14 | requestWindowFeature(Window.FEATURE_NO_TITLE); |
16 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
17 | WindowManager.LayoutParams.FLAG_FULLSCREEN); |
19 | setContentView(R.layout.main); |
Comments
Post a Comment