The Android mobile operating system is an open-source mobile operating system launched by Google based on Linux. We can perform corresponding operations on the simulator to implement various functions to meet user needs. Here we will briefly introduce how to implement full screen in Android.
The implementation of the new version of Android Framework is somewhat different from that of the old version. Here, only the full screen code of the new Android version is provided.
- Package pub. tetris;
- Import android. app. Activity;
- Import android. OS. Bundle;
- Import android. view. Window;
- Import android. view. WindowManager;
- Public class TetrisActivity extends Activity {
- /** Called when the activity is first created .*/
- @ Override
- Public void onCreate (Bundle savedInstanceState ){
- Super. onCreate (savedInstanceState );
- /** Full screen settings to hide all decorations in the window */
- GetWindow (). setFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN,
- WindowManager. LayoutParams. FLAG_FULLSCREEN );
- /** The title belongs to the View, so the title is still valid after all the modifiers in the window are hidden */
- RequestWindowFeature (Window. FEATURE_NO_TITLE );
- TileView tile = new TileView (this );
- Tetris tetris = new Tetris ();
- Tetris. init (tile );
- Thread engine = new Thread (tetris );
- SetContentView (tile );
- Engine. start ();
- }
- }
The full screen mode for Android is described here.