There was a time when I didn't write a blog post and found that the completeness of my blog was not very good. Take the Androidui component of this piece. has not been updated. I will update as soon as possible. All right. Not much to say, today to see the Actionbar.
According to the style of the past. Knowledge points are in the form of code gaze in the source.
Package com.gc.actionbardemo;/** * 1, Activity Bar (ActionBar) is one of the important updates of Android3.0.Actionbar is located in the position of the traditional title bar * That is, the top of the displayed screen. The Actionbar can display the app's icon and activity title---which is what is displayed at the top of the app's program. Besides. The right side of the Actionbar is also able to display active items. * 2, Actionbar provides for example the following functions * (1) The menu item that displays the Options menu (Display item as action Item) * (2) Use the program icon as the back home screen or up navigation operation * (3) Provide interactive view as Action View * (4 Provides tab-based navigation, which can be used to toggle multiple fragment * (5) to provide a pull-based navigation method * 3, assuming you want to turn off Actionbar. The ability to set the theme for the app is Xxx.noactionbar * 4, once the Actionbar is turned off. The Android app will not be able to use Actionbar * 5, in the actual project. It is usually recommended to use code to control ActionBar display, hide, ActionBar * Provides for example the following methods to control the display, hiding. * Show (): Show ActionBar * Hide (): Hide ActionBar */import android.os.bundle;import android.app.actionbar;import Android.app . Activity;import android.view.menu;import android.view.view;/** * * @author Android General * */public class Actionbartest Exten DS Activity {private ActionBar ActionBar; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate ( Savedinstancestate); Setcontentview (r.layout.activity_action_bar_test);//Get the activity's actionbar// The code is able to return Actionbaractionbar=getactionbar () only if the application theme does not close Actionbar;} Define an event-handling method for the "Show Actionbar" button public voID Showactionbar (View source) {//display actionbaractionbar.show ();} Define event handling method for "Hide Actionbar" button public void Hideactionbar (View source) {//Hide actionbaractionbar.hide ();}}
The corresponding layout file for the activity is activity_action_bar_test, and the code looks like this:
<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools " android:layout_width=" match_parent " android:layout_height=" Match_parent " > <button android:onclick= "Showactionbar" android:layout_width= "Wrap_content " android:layout_height= "Wrap_content" android:text= "show Actionbar"/> <button android:onclick= " Hideactionbar " android:layout_width=" wrap_content " android:layout_height=" Wrap_content " Android : text= "Hide Actionbar"/></linearlayout>
Examples of performance demos are as follows:
Reprint Please specify source: http://blog.csdn.net/android_jiangjun/article/details/38230733
Actionbar of Androidui Components