Android Apidemos Sample Resolution (5) App->activity->custom Title

Source: Internet
Author: User

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

App->activity->custom Title re-defines the activity title bar as a left or right two text box whose layout definition r.layout.custom_title_1 as follows

<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>

is a left and right two text box.

For each activity, in addition to using the Content view set by Setcontentview, there is also 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 make customizations: the FEATURE ID corresponding to the custom title bar is 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);

Related Article

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.