This article contains 3 kinds of hidden top status bar and title bar and a hidden Android 4.0 flat bottom status bar method, share for everyone to refer to, specific content as follows
Method One
public class Mainactivity extends activity
{
@Override
protected void onCreate (Bundle savedinstancestate)
{
super.oncreate (savedinstancestate);
Hide title bar
requestwindowfeature (window.feature_no_title);
Hides the status bar
GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Setcontentview (R.layout.activity_main);
}
Method Two
<!--hide both the status bar and the title bar-->
<activity
android:name= "com.ysj.demo.MainActivity
android:theme=" @ Android:style/theme.notitlebar.fullscreen "
android:label=" @string/app_name ">
<intent-filter>
<action android:name= "Android.intent.action.MAIN"/>
<category android:name= " Android.intent.category.LAUNCHER "/>
</intent-filter>
</activity>
Method Three
<!--application theme. -->
<style name= "Apptheme" parent= "Appbasetheme" >
<!--All customizations this are not specific To a particular api-level can go. -->
<!--hide status bar-->
<item name= "Android:windowfullscreen" >true</item>
<!-- Hide title bar-->
<item name= "Android:windownotitle" >true</item>
</style>
Note:
1, method One of the two pieces of code before Setcontentview ().
2, method Two can only hide both the status bar and the title bar.
3, method One and method two are only applied to single activity. Method three applies to the whole program.
For tablets running more than 4.0 Android systems, the above three methods do not hide the status bar below the screen, and should be handled as follows.
public class Startupactivity extends activity {@Override protected void onCreate (Bundle savedinstancestate) {Super
. OnCreate (Savedinstancestate);
Setcontentview (R.layout.activity_startup);
* * Hide the status bar at the bottom of the screen of the tablet running Android 4.0 +/try {String procid = "79"; if (Android.os.Build.VERSION.SDK_INT >= Android.os.Build.VERSION_CODES. Ice_cream_sandwich) ProcID = "42"; ICS//requires root permission Process proc = Runtime.getruntime (). EXEC (new string[] {"Su", "-C", "service call activity "+ ProcID +" S16 Com.android.systemui "});
was Proc.waitfor ();
The catch (Exception ex) {Toast.maketext (Getapplicationcontext (), Ex.getmessage (), Toast.length_long). Show (); } @Override protected void OnDestroy () {//TODO auto-generated Method Stub * * Restore the Flat Panel screen running Android more than 4.0 system The status bar at the bottom of the screen/try {Process proc = runtime.getruntime (). EXEC (new string[] {"AM", "StartService", "-N", "Com.and roid.systemui/. Systemuiservice "});
Proc.waitfor ();
catch (Exception e) {e.printstacktrace ();
} Super.ondestroy (); @Override public boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu; This adds the items to the action Bar if
It is present.
Getmenuinflater (). Inflate (R.menu.startup, menu);
return true; @Override public boolean onoptionsitemselected (MenuItem Item) {//TODO auto-generated the method stub switch (item.ge
Titemid ()) {case r.id.action_exit:finish ();
Break
return true;
}
}
Because there is no status bar, you must provide a way to exit the program in your program.
I hope this article will help you learn about Android software programming.