Many Android programs now show buttons and titles on the title bar, and try to do an example here.
Add in OnCreate:
// Custom Title requestwindowfeature (Window.feature_custom_title); Setcontentview (r.layout.main); // set the title to a layoutGetWindow (). Setfeatureint (Window.feature_custom_title, R.layout.titlebar);
Layout file:
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Fill_parent"Android:layout_height= "Wrap_content"android:orientation= "Horizontal" > <ButtonAndroid:id= "@+id/back"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "Back"android:textsize= "18SP"/> <TextViewAndroid:layout_width= "0DP"Android:layout_weight= "1"Android:layout_height= "Wrap_content"Android:text= "title"android:textsize= "18SP"android:gravity= "Center" /> <ButtonAndroid:id= "@+id/back"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "Next"android:textsize= "18SP"/></LinearLayout>
To avoid conflicts, modify: Androidmanifest.xml
Style
<name= "MyStyle" parent= "Android:theme"> <name= "android:windowtitlesize">50dp</ Item></style>
>>>>>>> Example Download