< one > Set fullscreen
1. Insert Requestwindowfeature (Window.feature_no_title) before Setcontentview () in the Oncreat method;//Cancel title bar
GetWindow (). SetFlags (Windowmanager.layoutparams. Flag_fullscreen,windowmanager.layoutparams. Flag_fullscreen);//Cancel status bar
Note: This method flashes the status bar after activating the activity and then fullscreen
2, in manifest configuration: <activity android:theme= "@android: Style/theme.notitlebar.fullscreen"/> Only in the current Activity display full screen
<application android:theme= "@android: Style/theme.notitlebar.fullscreen"/> Configure full-screen display for the entire app
3,/** * Full Screen switch * *
public void Fullscreenchange () {
Sharedpreferences mpreferences = preferencemanager.getdefaultsharedpreferences (this);
Boolean fullscreen = Mpreferences.getboolean ("fullscreen", false);
Windowmanager.layoutparams attrs = GetWindow (). GetAttributes ();
System.out.println ("fullscreen value:" + fullscreen);
if (fullscreen) {
Attrs.flags &= (~windowmanager.layoutparams.flag_fullscreen);
GetWindow (). SetAttributes (Attrs);
Cancel Full Screen settings
GetWindow (). Clearflags (WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Mpreferences.edit (). Putboolean ("fullscreen", false). commit ();
} else {
Attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
GetWindow (). SetAttributes (Attrs);
GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Mpreferences.edit (). Putboolean ("fullscreen", true). commit ();
}
}
< two >activity Jump pass value
With intent
Mainactivity
Intent in = new Intent (mainactivity.this,toactivity.class);
Bundle Bu = new bundle ();//vector of multiple values
Bu.putstring ("Name", str);
In.putextras (Bu);
StartActivity (in);
Toactivity
Bundle bundle = This.getintent (). Getextras ();
T2= (TextView) Findviewbyid (R.id.helloview);
/* Get data from bundles, note types and key*/
String name = bundle.getstring ("name");
< three >tabhost
Tabhost tabhost = (tabhost) Findviewbyid (r.id.tabhost);
Tabhost.setup ();
Tabhost.addtab (Tabhost.newtabspec ("Tab1"). Setindicator ("Tab1"). SetContent (R.id.view1));
Tabhost.addtab (Tabhost.newtabspec ("TaB2"). Setindicator ("Tab2"). SetContent (R.ID.VIEW2));
Tabhost.addtab (Tabhost.newtabspec ("Tab3"). Setindicator ("Tab3"). SetContent (R.ID.VIEW3));
XML layout file
<?xml version= "1.0" encoding= "Utf-8"?>
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:id= "@+id/hometabs"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:orientation= "Vertical" >
<tabhost
Android:id= "@+id/tabhost"
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content" >
<linearlayout
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:orientation= "Vertical" >
<framelayout
Android:id= "@android: Id/tabcontent"
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content" >
<textview
Android:id= "@+id/view1"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:text= "First label"/>
<textview
android:id= "@+id/view2"
Android : layout_width= "fill_parent"
android:layout_height= "Fill_parent"
An droid:text= "Second label"/>
<textview
android:id= "@+id/view3"
Android : layout_width= "fill_parent"
android:layout_height= "Fill_parent"
An droid:text= "Third label"/>
</framelayout>
<relativelayout
An Droid:layout_width= "Match_parent"
android:layout_height= "match_parent" >
< Tabwidget
android:id= "@android: Id/tabs"
android:layout_width= "match_parent "
android:layout_height=" wrap_content "
android:layout_alignparentbottom=" t Rue "
</tabwidget>
</relativelayout>
</linearlayout
</tabhost>
</linearlayout>