It is easy for Android to remove the title bar and full screen. There are two common methods:
First, implement in the program:
- This. requestwindowfeature (window. feature_no_title); // remove the title bar.
- This. getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, windowmanager. layoutparams. flag_fullscreen); // remove the Information bar Note: The two lines of code should be written before the page is displayed, that is, setcontentview (R. layout. XXX) before
Second, the Android: Theme tag is implemented in the androidmanifest. xml configuration file.
- <Activity Android: Name = "activity1"
- Android: theme = "@ Android: style/theme. notitlebar. fullscreen"> </activity>
Note: If you do not need full screen, you only need to write Android: theme = "@ Android: style/theme. notitlebar to OK.
Summary: differences between the two
The first method is to temporarily display the title bar and Information bar when the activity is started, and then disappear. This does not happen in the second method, and it looks smooth.
Modify the timeout sleep time:
By default, the android system does not operate for more than n minutes, and the screen is automatically closed and sleep.
In fact, some projects require timeout and not sleep. If it is only for a single application, we can set the status through power management,
If you want to set the timeout time for all applications, you can refer to the following methods:
Method 1: Adjust the Code:
Settings. system. putint (getcontentresolver (), Android. provider. settings. system. screen_off_timeout,-1 );
Permission: <uses-Permission Android: Name = "android. Permission. write_settings"/>
Method 2: Adjust the database:
These settings of Android are stored in the SQL database, that is, you can directly modify the database to prevent android from sleep.
Sqlite3/data/COM. Android. providers. Settings/databases/settings. DB
Specific SQL: update system set value = '-1' where name = 'screen _ off_timeout ';