Requestwindowfeature (Featrueid), its function is to enable the form's extended attributes. Parameters are constants defined in the window class.
One, enumeration constants
1.default_features: System default state, generally do not need to specify
2.feature_context_menu: Enable ContextMenu, which is enabled by default, generally does not need to specify
3.feature_custom_title: Custom caption. You must specify when you want to customize the caption. such as: When the caption is a button
4.feature_indeterminate_progress: Indeterminate Progress
5.feature_left_icon: Icon to the left of the title bar
6.feature_no_title: no title
7.feature_options_panel: Enable the Options Panel feature, which is enabled by default.
8.feature_progress: Progress indicator function
9.feature_right_icon: Icon to the right of the title bar
Second, detailed
Default display Status
1.feature_custom_title detailed
This . Requestwindowfeature (window.feature_custom_title); Setcontentview (r.layout.main);
This is because there is no setup featrue
After the above code add: GetWindow (). Setfeatureint (Window.feature_custom_title, r.layout.title);
Custom caption completion, which is an XML file layout
<?XML version= "1.0" encoding= "Utf-8"?> <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content" > <ImageViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:src= "@drawable/ic_launcher" /> <TextViewAndroid:id= "@+id/text"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_alignparentleft= "true"Android:textcolor= "#000000"Android:text= "Feature_custom_title" /> </LinearLayout>
2.feature_indeterminate_progress detailed
Can be used to indicate that a process is running
This . Requestwindowfeature (window.feature_indeterminate_progress); Setcontentview (r.layout.main); GetWindow (). Setfeatureint (window.feature_indeterminate_progress, r.layout.progress); Setprogressbarindeterminatevisibility (true);
<?XML version= "1.0" encoding= "Utf-8"?> <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content" > <ProgressBarAndroid:id= "@+id/progress"style= "? Android:attr/progressbarstylesmalltitle"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:layout_gravity= "Center_vertical" > </ProgressBar> </LinearLayout>
3.feature_left_icon and Feature_right_icon detailed
// 111 requestwindowfeature (Window.feature_right_icon); Setcontentview (r.layout.main); GetWindow (). Setfeaturedrawableresource (Window.feature_right_icon,r.drawable.ic_launcher); // 222 requestwindowfeature (Window.feature_left_icon); Setcontentview (r.layout.main); GetWindow (). Setfeaturedrawableresource (Window.feature_left_icon,r.drawable.ic_launcher);
4.feature_no_title Detailed
This . Requestwindowfeature (window.feature_no_title); Setcontentview (R.layout.main);
GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
This.requestwindowfeature (Window.feature_no_title) related