{"id":392,"date":"2023-09-08T19:51:29","date_gmt":"2023-11-18T22:34:25","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/index.php\/2023\/11\/30\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/"},"modified":"2025-08-02T03:53:49","modified_gmt":"2025-08-01T19:53:49","slug":"android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","title":{"rendered":"Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3"},"content":{"rendered":"<p>\u4eca\u5929\u6211\u4eec\u5c06\u63a2\u8ba8Android\u7684\u64cd\u4f5c\u680f\uff08ActionBar\uff09\u3002\u64cd\u4f5c\u680f\u662f\u4efb\u4f55\u5e94\u7528\u7a0b\u5e8f\u7684\u91cd\u8981\u90e8\u5206\uff0c\u65e0\u8bba\u662fWeb\u5e94\u7528\u8fd8\u662f\u79fb\u52a8\u5e94\u7528\u3002\u4eca\u5929\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u4f7f\u7528ActionBar\u7ec4\u4ef6\u5728Android\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5b9e\u73b0\u64cd\u4f5c\u680f\u3002<\/p>\n<h2>\u5b89\u5353\u7684\u64cd\u4f5c\u680f<\/h2>\n<p>\u5b89\u5353\u7684ActionBar\u662f\u5b89\u5353\u6d3b\u52a8\u5c4f\u5e55\u9876\u90e8\u6a2a\u8de8\u7684\u83dc\u5355\u680f\u3002\u5b89\u5353\u7684ActionBar\u53ef\u4ee5\u5305\u542b\u83dc\u5355\u9879\uff0c\u5728\u7528\u6237\u70b9\u51fb\u201c\u83dc\u5355\u201d\u6309\u94ae\u65f6\u53ef\u89c1\u3002\u4e00\u822c\u800c\u8a00\uff0c\u4e00\u4e2aActionBar\u7531\u4ee5\u4e0b\u56db\u4e2a\u7ec4\u4ef6\u7ec4\u6210\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>App Icon: App branding logo or icon will be displayed here<\/li>\n<li>View Control: A dedicated space to display Application title. Also provides option to switch between views by adding spinner or tabbed navigation<\/li>\n<li>Action Buttons: Some important actions of the app can be added here<\/li>\n<li>Action Overflow: All unimportant action will be shown as a menu<\/li>\n<\/ul>\n<h3>Android\u64cd\u4f5c\u680f\u8bbe\u7f6e<\/h3>\n<p>\u6240\u6709\u4f7f\u7528Theme.Holo\u4e3b\u9898\u6216\u6d3e\u751f\u4e8eTheme.Holo\u4e3b\u9898\u7684\u6d3b\u52a8\u90fd\u4f1a\u81ea\u52a8\u5305\u542b\u4e00\u4e2aActionBar\u3002<\/p>\n<h3>\u5b89\u5353\u64cd\u4f5c\u680f\u83dc\u5355<\/h3>\n<p>\u5c06\u5de5\u5177\u680f\u56fe\u6807\u548c\u64cd\u4f5c\u6ea2\u51fa\u9879\u6dfb\u52a0\u5230\u64cd\u4f5c\u680f\u7684\u6700\u7b80\u5355\u65b9\u6cd5\u662f\u521b\u5efa\u4f4d\u4e8eres\/menu\u6587\u4ef6\u5939\u4e2d\u7684\u83dc\u5355XML\u8d44\u6e90\u6587\u4ef6\u3002\u6211\u4eec\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u65b9\u5f0f\u5c06\u83dc\u5355\u9879\u6dfb\u52a0\u5230\u8be5\u6587\u4ef6\u5939\u4e2d\u7684\u539f\u59cbXML\u6587\u4ef6\u4e2d\uff1amenu_main.xml\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;menu xmlns:android=\"https:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:app=\"https:\/\/schemas.android.com\/apk\/res-auto\"\r\n    xmlns:tools=\"https:\/\/schemas.android.com\/tools\" tools:context=\".MainActivity\"&gt;\r\n    \r\n    &lt;item\r\n        android:id=\"@+id\/add\" android:icon=\"@android:drawable\/ic_menu_add\" app:showAsAction=\"always\"   android:title=\"@string\/add\"\/&gt;\r\n    &lt;item\r\n        android:id=\"@+id\/reset\" android:icon=\"@android:drawable\/ic_menu_revert\" app:showAsAction=\"always|withText\" android:title=\"@string\/reset\"\/&gt;\r\n    &lt;item\r\n        android:id=\"@+id\/about\" android:icon=\"@android:drawable\/ic_dialog_info\" app:showAsAction=\"never\" android:title=\"@string\/about\"&gt;\r\n    &lt;\/item&gt;\r\n    &lt;item\r\n        android:id=\"@+id\/exit\"  app:showAsAction=\"never\" android:title=\"@string\/exit\"&gt;\r\n    &lt;\/item&gt;\r\n&lt;\/menu&gt;\r\n<\/code><\/pre>\n<p>\u6bcf\u4e2a\u83dc\u5355\u9879\u9700\u8981\u914d\u7f6e\u56db\u4e2a\u4e8b\u9879\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>android:id\u5c5e\u6027\u6307\u5b9a\u4e86\u83dc\u5355\u9879\u7684id\u3002\u8fd9\u4e0eAndroid\u5e94\u7528\u4e2d\u7684\u5176\u4ed6\u5730\u65b9\u7684id\u4e00\u6837\u5de5\u4f5c\u3002\u4ee5@+id\/\u5f00\u5934\u7684android:id\u503c\u5c06\u5728R.menu\u5e38\u91cf\u96c6\u5408\u4e2d\u521b\u5efa\u4e00\u4e2a\u5e38\u91cf<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>android:title\u5c5e\u6027\u503c\u5305\u542b\u4e86\u83dc\u5355\u9879\u7684\u6807\u9898<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>android:icon\u5c5e\u6027\u5f15\u7528\u4e86drawable\u76ee\u5f55\u4e2d\u7684\u56fe\u6807<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>android:showAsAction\u5c5e\u6027\u6307\u793a\u7ed9\u5b9a\u7684\u9879\u5728\u64cd\u4f5c\u680f\u4e2d\u5e94\u8be5\u5982\u4f55\u5c55\u793a\u3002\u6211\u4eec\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u4efb\u4e00\u6807\u5fd7\u4e2d\u9009\u62e9\uff1a<\/ol>\n<\/li>\n<\/ol>\n<p>always\uff1a\u59cb\u7ec8\u5c06\u5176\u4fdd\u7559\u5728\u64cd\u4f5c\u680f\u4e2d<br \/>\nifRoom\uff1a\u5f53\u6709\u7a7a\u95f4\u65f6\u624d\u4fdd\u7559<br \/>\nnever\uff1a\u610f\u5473\u7740\u8be5\u83dc\u5355\u9879\u4e0d\u4f1a\u4f5c\u4e3a\u56fe\u6807\u653e\u7f6e\u5728\u64cd\u4f5c\u680f\u4e2d\u3002\u5b83\u53ea\u4f1a\u5728\u5355\u51fb\u83dc\u5355\u6309\u94ae\u65f6\uff0c\u5728\u5f39\u51fa\u7684\u83dc\u5355\u4e2d\u53ef\u89c1<br \/>\n|withText\uff1a\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u9644\u52a0\u5230always\u6216ifRoom\uff0c\u8868\u793a\u5de5\u5177\u680f\u6309\u94ae\u65e2\u662f\u56fe\u6807\u53c8\u662f\u6807\u9898\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u56fe\u6807<\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u59cb\u7ec8\uff08always\uff09\u5e76\u975e\u4fdd\u8bc1\u4f1a\u4f5c\u4e3a\u4e00\u4e2a\u5de5\u5177\u680f\u6309\u94ae\u5b58\u5728 &#8211; \u5982\u679c\u60a8\u8981\u6c42\u59cb\u7ec8\uff08always\uff09\u663e\u793a100\u4e2a\u9879\u76ee\uff0c\u5c06\u65e0\u6cd5\u5bb9\u7eb3\u5b83\u4eec\u6240\u6709\u3002\u7136\u800c\uff0c\u59cb\u7ec8\uff08always\uff09\u9879\u76ee\u5728\u64cd\u4f5c\u680f\u4e2d\u5177\u6709\u6bd4ifRoom\uff08\u5982\u679c\u6709\u7a7a\u95f4\uff09\u9879\u76ee\u66f4\u9ad8\u7684\u4f18\u5148\u7ea7\uff0c\u4ee5\u4fbf\u5360\u7528\u7a7a\u95f4\u3002<\/p>\n<h3>\u5c06\u83dc\u5355\u6269\u5c55\u81f3Android\u7684\u64cd\u4f5c\u680f\u4e2d<\/h3>\n<p>\u4e3a\u4e86\u663e\u793a\u5728\u83dc\u5355XML\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\u83dc\u5355\u9879\uff0c\u60a8\u9700\u8981\u52a0\u8f7d\u8be5\u83dc\u5355\u6587\u4ef6\u3002\u6211\u4eec\u53ef\u4ee5\u5728\u5e0c\u671b\u6dfb\u52a0ActionBar\u7684\u6d3b\u52a8\u7684onCreateOptionsMenu()\u65b9\u6cd5\u4e2d\u8fdb\u884c\u6b64\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4ee3\u7801\u7247\u6bb5\uff1a<\/p>\n<pre class=\"post-pre\"><code>@Override\r\npublic boolean onCreateOptionsMenu(Menu menu) {\r\n    \/\/ Inflate the menu; this adds items to the action bar if it is present.\r\n    getMenuInflater().inflate(R.menu.menu_main, menu);\r\n    return true;\r\n}\r\n<\/code><\/pre>\n<p>R.menu.menu_main\u53c2\u6570\u662f\u6307\u5411\u83dc\u5355XML\u6587\u4ef6\u7684\u5e38\u91cf\u3002\u83dc\u5355\u53c2\u6570\u662f\u6211\u4eec\u5e0c\u671b\u586b\u5145\u83dc\u5355\u9879\u7684\u83dc\u5355\u3002<\/p>\n<h3>\u54cd\u5e94Android\u64cd\u4f5c\u680f\u4e8b\u4ef6<\/h3>\n<p>\u4e3a\u4e86\u627e\u51fa\u7528\u6237\u4f55\u65f6\u70b9\u51fb\u8fd9\u4e9b\u4e1c\u897f\uff0c\u6211\u4eec\u9700\u8981\u8986\u76d6MainActivity\u4e2d\u7684onOptionsItemSelected()\u65b9\u6cd5\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"post-pre\"><code>@Override\r\npublic boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) {\r\n    case R.id.add:\r\n        \/\/add the function to perform here\r\n        return(true);\r\n    case R.id.reset:\r\n        \/\/add the function to perform here\r\n        return(true);\r\n    case R.id.about:\r\n        \/\/add the function to perform here\r\n        return(true);\r\n    case R.id.exit:\r\n        \/\/add the function to perform here\r\n        return(true);\r\n}\r\n    return(super.onOptionsItemSelected(item));\r\n}\r\n<\/code><\/pre>\n<p>\u73b0\u5728\u8ba9\u6211\u4eec\u7ed9\u9879\u76ee\u4e2d\u7684\u6bcf\u4e2a\u83dc\u5355\u9879\u5206\u914d\u4e00\u4e9b\u57fa\u672c\u529f\u80fd\u3002<\/p>\n<h3>\u9879\u76ee\u7ed3\u6784<\/h3>\n<h3>Android\u52a8\u4f5c\u680f\u793a\u4f8b\u4ee3\u7801<\/h3>\n<p>\u6211\u4eec\u5df2\u7ecf\u5728MainActivity\u4e2d\u6309\u7167\u4e0b\u9762\u4ee3\u7801\u7247\u6bb5\u6240\u793a\u5b9e\u73b0\u4e86\u56db\u4e2a\u83dc\u5355\u9879\uff1aMainActivity.java<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.actionbar;\r\n\r\nimport android.os.Bundle;\r\nimport android.support.v7.app.AppCompatActivity;\r\nimport android.view.Menu;\r\nimport android.view.MenuItem;\r\nimport android.widget.TextView;\r\nimport android.widget.Toast;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n\r\n    TextView count;\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.activity_main);\r\n    }\r\n\r\n    @Override\r\n    public boolean onCreateOptionsMenu(Menu menu) {\r\n        \/\/ Inflate the menu; this adds items to the action bar if it is present.\r\n        getMenuInflater().inflate(R.menu.menu_main, menu);\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) {\r\n        case R.id.add:\r\n            count=(TextView)findViewById(R.id.textView);\r\n            count.setText(\"Add is clicked\");\r\n            return(true);\r\n        case R.id.reset:\r\n            count=(TextView)findViewById(R.id.textView);\r\n            count.setText(\"Nothing is selected\");\r\n            return(true);\r\n        case R.id.about:\r\n            Toast.makeText(this, R.string.about_toast, Toast.LENGTH_LONG).show();\r\n            return(true);\r\n        case R.id.exit:\r\n            finish();\r\n            return(true);\r\n\r\n    }\r\n        return(super.onOptionsItemSelected(item));\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u5404\u4e2a\u9879\u76ee\u88ab\u5206\u914d\u4e86\u76f8\u5e94\u7684\u529f\u80fd\u3002\u6240\u9009\u9879\u76ee\u662f\u901a\u8fc7\u5728menu_main.xml\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684id\u786e\u5b9a\u7684\u3002\u8fd9\u91cc\u6211\u4eec\u53ea\u662f\u6539\u53d8\u7b2c\u4e00\u4e2a\u548c\u7b2c\u4e8c\u4e2a\u9879\u76ee\u4e2d\u7684TextView\u5185\u5bb9\uff0c\u5728\u7b2c\u4e09\u4e2a\u9879\u76ee\u4e2d\u663e\u793a\u4e00\u4e2atoast\uff0c\u5728\u7b2c\u56db\u4e2a\u9879\u76ee\u4e2d\u9000\u51fa\u5e94\u7528\u7a0b\u5e8f\u3002\u8bf7\u6ce8\u610f\uff0cAppCompatActivity\u662fActionBarActivity\u7684\u4e00\u4e2a\u66ff\u4ee3\u7248\u672c\u3002styles.xml\u6587\u4ef6\u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n<pre class=\"post-pre\"><code>&lt;resources&gt;\r\n\r\n    &lt;!-- Base application theme. --&gt;\r\n    &lt;style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\"&gt;\r\n        &lt;!-- Customize your theme here. --&gt;\r\n    &lt;\/style&gt;\r\n\r\n&lt;\/resources&gt;\r\n<\/code><\/pre>\n<p>\u4f60\u53ef\u4ee5\u770b\u5230\uff0c\u7236\u4e3b\u9898\u4f7f\u7528\u4e86Theme.AppCompat\u7684\u4e00\u4e2a\u884d\u751f\u7248\u672c\uff0c\u8be5\u7248\u672c\u9ed8\u8ba4\u5305\u542bActionBar\uff08\u9664\u975e\u4f7f\u7528Theme.AppCompat.Light.NoActionBar\u7c7b\uff09\u3002\u56e0\u6b64\u5728\u8fd9\u91cc\u6ca1\u6709\u5fc5\u8981\u663e\u5f0f\u5730\u5b9a\u4e49\u5b83\u3002<\/p>\n<h3>\u5b89\u5353\u64cd\u4f5c\u680f\u7684\u540e\u79fb\u642d\u5efa<\/h3>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u81ea\u4eceAndroid Honeycomb 3.0\u4e4b\u540e\u5f15\u5165\u4e86ActionBar\uff0c\u5982\u679cminSdkVersion\u5c0f\u4e8e\u6216\u7b49\u4e8e11\uff0c\u6211\u4eec\u9700\u8981\u5bfc\u5165app-compat-v7 jar\u5230\u6211\u4eec\u7684gradle\u4e2d\u4ee5\u5b9e\u73b0ActionBar\uff0c\u5c31\u50cf\u6211\u4eec\u5728\u8fd9\u91cc\u6240\u505a\u7684\u4e00\u6837\uff0c\u4ee5\u542f\u7528\u5411\u540e\u517c\u5bb9\u6027\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u72ec\u7acb\u4e8e\u64cd\u4f5c\u680f\u8865\u4e01\uff0c\u5bfc\u5165\u5e76\u6269\u5c55MainActivity\u4e0eActionBarSherlock\u7c7b\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u7c7b\u662f\u5728Android 3.0\u4e4b\u540e\u5f15\u5165\u7684\u3002<\/ol>\n<p>\u4e0b\u56fe\u663e\u793a\u4e86\u6211\u4eec\u9879\u76ee\u751f\u6210\u7684\u8f93\u51fa\u7ed3\u679c\u3002\u60a8\u53ef\u4ee5\u770b\u5230ActionBar\u5305\u542b\u4e86\u9884\u5b9a\u4e49\u7684\u56fe\u6807\u3002\u5f53\u70b9\u51fb\u6dfb\u52a0\u56fe\u6807\u65f6\uff0cTextView\u66f4\u65b0\u5185\u5bb9\u3002\u5f53\u70b9\u51fb\u91cd\u7f6e\u65f6\uff0cTextView\u5c06\u5185\u5bb9\u6062\u590d\u5230\u539f\u59cb\u72b6\u6001\u3002\u5f53\u70b9\u51fb\u5173\u4e8e\u65f6\uff0c\u5982\u4e0b\u6240\u793a\u51fa\u73b0toast\u901a\u77e5\u3002\u8fd9\u5c31\u7ed3\u675f\u4e86\u5173\u4e8eAndroid ActionBar\u793a\u4f8b\u6559\u7a0b\u7684\u4ecb\u7ecd\u3002\u60a8\u8fd8\u5e94\u8be5\u9605\u8bfb\u6709\u5173Android\u81ea\u5b9a\u4e49ActionBar\u7684\u5185\u5bb9\u3002\u60a8\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u94fe\u63a5\u4e0b\u8f7dAndroid ActionBar\u9879\u76ee\u3002<\/p>\n<p>\u4e0b\u8f7dAndroid ActionBar\u5b9e\u4f8b\u9879\u76ee<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u6211\u4eec\u5c06\u63a2\u8ba8Android\u7684\u64cd\u4f5c\u680f\uff08ActionBar\uff09\u3002\u64cd\u4f5c\u680f\u662f\u4efb\u4f55\u5e94\u7528\u7a0b\u5e8f\u7684\u91cd\u8981\u90e8\u5206\uff0c\u65e0\u8bba\u662fWeb\u5e94\u7528\u8fd8 [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1271,1272,900],"class_list":["post-392","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-actionbar","tag-android-ui","tag-android"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecdAndroid ActionBar\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u5b9e\u4f8b\uff0c\u5305\u62ecActionBar\u7684\u57fa\u672c\u914d\u7f6e\u3001\u6dfb\u52a0\u83dc\u5355\u9879\u3001\u5bfc\u822a\u6a21\u5f0f\u7b49\u3002\u901a\u8fc7\u4e30\u5bcc\u7684\u4ee3\u7801\u793a\u4f8b\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1Android ActionBar\u7684\u5b9e\u73b0\u6280\u5de7\uff0c\u63d0\u5347\u5e94\u7528\u7684\u7528\u6237\u754c\u9762\u4f53\u9a8c\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-\u793a\u4f8b\u6559\u7a0b\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecdAndroid ActionBar\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u5b9e\u4f8b\uff0c\u5305\u62ecActionBar\u7684\u57fa\u672c\u914d\u7f6e\u3001\u6dfb\u52a0\u83dc\u5355\u9879\u3001\u5bfc\u822a\u6a21\u5f0f\u7b49\u3002\u901a\u8fc7\u4e30\u5bcc\u7684\u4ee3\u7801\u793a\u4f8b\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1Android ActionBar\u7684\u5b9e\u73b0\u6280\u5de7\uff0c\u63d0\u5347\u5e94\u7528\u7684\u7528\u6237\u754c\u9762\u4f53\u9a8c\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-\u793a\u4f8b\u6559\u7a0b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-18T22:34:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-01T19:53:49+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\",\"name\":\"Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-11-18T22:34:25+00:00\",\"dateModified\":\"2025-08-01T19:53:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"description\":\"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecdAndroid ActionBar\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u5b9e\u4f8b\uff0c\u5305\u62ecActionBar\u7684\u57fa\u672c\u914d\u7f6e\u3001\u6dfb\u52a0\u83dc\u5355\u9879\u3001\u5bfc\u822a\u6a21\u5f0f\u7b49\u3002\u901a\u8fc7\u4e30\u5bcc\u7684\u4ee3\u7801\u793a\u4f8b\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1Android ActionBar\u7684\u5b9e\u73b0\u6280\u5de7\uff0c\u63d0\u5347\u5e94\u7528\u7684\u7528\u6237\u754c\u9762\u4f53\u9a8c\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3 - Blog - Silicon Cloud","description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecdAndroid ActionBar\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u5b9e\u4f8b\uff0c\u5305\u62ecActionBar\u7684\u57fa\u672c\u914d\u7f6e\u3001\u6dfb\u52a0\u83dc\u5355\u9879\u3001\u5bfc\u822a\u6a21\u5f0f\u7b49\u3002\u901a\u8fc7\u4e30\u5bcc\u7684\u4ee3\u7801\u793a\u4f8b\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1Android ActionBar\u7684\u5b9e\u73b0\u6280\u5de7\uff0c\u63d0\u5347\u5e94\u7528\u7684\u7528\u6237\u754c\u9762\u4f53\u9a8c\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-\u793a\u4f8b\u6559\u7a0b\/","og_locale":"zh_CN","og_type":"article","og_title":"Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3","og_description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecdAndroid ActionBar\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u5b9e\u4f8b\uff0c\u5305\u62ecActionBar\u7684\u57fa\u672c\u914d\u7f6e\u3001\u6dfb\u52a0\u83dc\u5355\u9879\u3001\u5bfc\u822a\u6a21\u5f0f\u7b49\u3002\u901a\u8fc7\u4e30\u5bcc\u7684\u4ee3\u7801\u793a\u4f8b\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1Android ActionBar\u7684\u5b9e\u73b0\u6280\u5de7\uff0c\u63d0\u5347\u5e94\u7528\u7684\u7528\u6237\u754c\u9762\u4f53\u9a8c\u3002","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-\u793a\u4f8b\u6559\u7a0b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-11-18T22:34:25+00:00","article_modified_time":"2025-08-01T19:53:49+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","name":"Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-11-18T22:34:25+00:00","dateModified":"2025-08-01T19:53:49+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecdAndroid ActionBar\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u5b9e\u4f8b\uff0c\u5305\u62ecActionBar\u7684\u57fa\u672c\u914d\u7f6e\u3001\u6dfb\u52a0\u83dc\u5355\u9879\u3001\u5bfc\u822a\u6a21\u5f0f\u7b49\u3002\u901a\u8fc7\u4e30\u5bcc\u7684\u4ee3\u7801\u793a\u4f8b\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1Android ActionBar\u7684\u5b9e\u73b0\u6280\u5de7\uff0c\u63d0\u5347\u5e94\u7528\u7684\u7528\u6237\u754c\u9762\u4f53\u9a8c\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Android ActionBar\u4f7f\u7528\u6559\u7a0b\u4e0e\u5b9e\u4f8b\u8be6\u89e3"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/android-actionbar-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=392"}],"version-history":[{"count":4,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/392\/revisions"}],"predecessor-version":[{"id":109958,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/392\/revisions\/109958"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}