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 | <activityandroid: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 | packagecom.prgguru.android; | 
 
| 3 | importandroid.os.Bundle; | 
 
| 4 | importandroid.app.Activity; | 
 
| 5 | importandroid.view.Window; | 
 
| 6 | importandroid.view.WindowManager; | 
 
| 8 | publicclassFullScreenExampleActivity extendsActivity { | 
 
| 11 |     publicvoidonCreate(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