"Sail Plan 006" 2015 sail plan Android apidemo Devil Pace app->activity->custom Title custom title bar

Source: Internet
Author: User

The default title bar for Android UI is defined by Android:label, which appears in the upper-left corner of the screen, Android allows activity to customize the title bar, and uses custom layout to reset the title bar, such as implementing the Windows Mobile style title bar.

App->activity->custom title re-defined Activity title bar as left and right two text boxes, class customtitle, its layout definition r.layout.custom_title_1 as follows, As a left-right two text box:

<!--Demonstrates how to use a custom title. See corresponding Java code Com.example.android.apis.app.CustomTitle.java. --><relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" android:id= "@+id/screen"Android:layout_width= "Match_parent" android:layout_height= "Match_parent"android:orientation= "vertical" > <textview android:id= "@+id/left_text"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_alignparentleft= "true"Android:text= "@string/custom_title_left"/> <textview android:id= "@+id/right_text"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_alignparentright= "true"Android:text= "@string/custom_title_right"/></relativelayout>

For each activity, in addition to using the content view set by Setcontentview, there is a Windows class object that controls the title bar, allows you to customize the title bar, or does not display the title bar.

Windows defines some FEATURE that allow developers to customize: The custom title bar corresponds to the FEATURE ID of Window.feature_custom_title.

         requestwindowfeature (window.feature_custom_title);        Setcontentview (r.layout.custom_title);        GetWindow (). Setfeatureint (Window.feature_custom_title, r.layout.custom_title_1);

The view in R.layout.custom_title_1 can be obtained directly from the Findviewbyid.

"Sail Plan 006" 2015 sail plan Android apidemo Devil Pace app->activity->custom Title custom title bar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.