{"id":189676,"date":"2014-01-14T18:58:03","date_gmt":"2014-01-14T14:58:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=189676"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=189676","title":{"rendered":"<span class=\"post_title\">ActionBar \u043d\u0430 Android 2.1+ \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Support Library. \u0427\u0430\u0441\u0442\u044c 3 \u2014 \u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412\u0441\u0435\u043c \u0434\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a!<\/p>\n<p>  \u041c\u0434\u0430, \u0434\u0430\u0432\u043d\u043e \u043d\u0435 \u043f\u0438\u0441\u0430\u043b \u044f \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u0425\u0430\u0431\u0440. \u0427\u0442\u043e \u0436, \u0431\u0443\u0434\u0443 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c.<br \/>  \u0412\u043e\u043e\u0431\u0449\u0435, ActionBar \u0432 Android \u2013 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430. \u0412 <a href=\"http:\/\/habrahabr.ru\/post\/189680\/\">\u043f\u0435\u0440\u0432\u043e\u0439<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/189678\/\">\u0432\u0442\u043e\u0440\u043e\u0439<\/a> \u0447\u0430\u0441\u0442\u044f\u0445 \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2013 \u043c\u0435\u043d\u044e \u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f. \u041d\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0434\u044c \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445: Split ActionBar, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 View \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0435\u043d\u044e \u0438 ActionProvider. \u041e \u043d\u0438\u0445 \u0438 \u043f\u043e\u0439\u0434\u0451\u0442 \u0440\u0435\u0447\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0431\u043e\u043d\u0443\u0441: \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u043d\u0430\u044e\u0442, \u0447\u0442\u043e \u043a\u043d\u043e\u043f\u043a\u0430 Up \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 Activity. \u041d\u043e \u0435\u0441\u043b\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u0434\u043d\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 Activity, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043a\u043e\u0434\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0432\u0432\u0435\u0440\u0445. \u0417\u0430\u0438\u043d\u0442\u0440\u0438\u0433\u043e\u0432\u0430\u043d\u044b? \u041f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>Split ActionBar<\/h4>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/a11\/e11\/f2b\/a11e11f2b31813dff4ea5762ad4418ed.png\"\/><\/p>\n<p>  Split ActionBar \u2013 \u044d\u0442\u043e \u043f\u043e\u043b\u043e\u0441\u043a\u0430 \u0432\u043d\u0438\u0437\u0443 \u044d\u043a\u0440\u0430\u043d\u0430 \u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043c\u0435\u043d\u044e. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d, \u0435\u0441\u043b\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c ActionBar \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043c\u0435\u0441\u0442\u0430 (\u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435), \u0438\u043b\u0438 \u043e\u043d \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 (\u0441\u043f\u0440\u0430\u0432\u0430). \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e: \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043b\u044f Activity \u0438\u043b\u0438 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"xml\">&lt;manifest ...&gt;     &lt;activity \u2026         uiOptions=&quot;splitActionBarWhenNarrow&quot; ... &gt; \/\/\u0414\u043b\u044f API 14+         &lt;meta-data android:name=&quot;android.support.UI_OPTIONS&quot; \/\/ \u0414\u043b\u044f Support Library API 7+                    android:value=&quot;splitActionBarWhenNarrow&quot; \/&gt;     &lt;\/activity&gt; &lt;\/manifest&gt; <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u0432\u0435\u0440\u0445\u043d\u0438\u0439 ActionBar (\u043a\u0430\u043a \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u0441\u043f\u0440\u0430\u0432\u0430) \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b ActionBar <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v7\/app\/ActionBar.html#setDisplayShowHomeEnabled(boolean)\">setDisplayShowHomeEnabled(false)<\/a> \u0438 <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v7\/app\/ActionBar.html#setDisplayShowTitleEnabled(boolean)\">setDisplayShowTitleEnabled(false)<\/a>.<\/p>\n<h4>ActionView<\/h4>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0435\u043d\u044e \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 (\u0438\u043a\u043e\u043d\u043a\u0438). \u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e:<br \/>  -\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 actionLayout \u0434\u043b\u044f \u0442\u0435\u0433\u0430 . \u041e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 layout-\u0444\u0430\u0439\u043b<br \/>  -\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 actionViewClass \u0434\u043b\u044f \u0442\u0435\u0433\u0430 , \u043a\u0443\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 View, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0432\u044c\u044e\u0445\u0438<\/p>\n<pre><code class=\"xml\">&lt;menu xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;       xmlns:yourapp=&quot;http:\/\/schemas.android.com\/apk\/res-auto&quot; &gt;     &lt;item android:id=&quot;@+id\/custom_action &quot;           android:title=&quot;@string\/custom_action &quot;           android:icon=&quot;@drawable\/ic_custom_action &quot;           yourapp:actionViewClass=&quot;com.you.app.CustomView&quot; \/&gt; &lt;\/menu&gt; <\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d android \u0432 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043d\u0435\u0442 \u044d\u0442\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0451\u043d Support Library \u2013 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 <b>xmlns:yourapp=\u00ab<a href=\"http:\/\/schemas.android.com\/apk\/res-auto\">schemas.android.com\/apk\/res-auto<\/a>\u00bb<\/b> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <b>yourapp:actionViewClass<\/b>. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 MenuItem\u2019a \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 MenuItemCompat <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/MenuItemCompat.html#setActionView(android.view.MenuItem, int)\">setActionView(MenuItem item, int resId)<\/a> \u0438 <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/MenuItemCompat.html#setActionView(android.view.MenuItem, android.view.View)\">setActionView(MenuItem item, View view)<\/a>, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 View \u2013 <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/MenuItemCompat.html#getActionView(android.view.MenuItem)\">getActionView(MenuItem item)<\/a>.<\/p>\n<p>  \u041e\u0434\u0438\u043d \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 ActionView \u2013 SearchView, \u043e \u043d\u0451\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"http:\/\/habrahabr.ru\/post\/189680\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h4>Action Provider<\/h4>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/b97\/09e\/3b0\/b9709e3b00ba5f4a2ce41ef88a3daa65.png\"\/><\/p>\n<p>  ActionProvider \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u0441 ActionView. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 layout, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0435\u043d\u044e. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u043f\u0443\u043d\u043a\u0442\u0430 \u043c\u0435\u043d\u044e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0433\u0430  \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <b>actionProviderClass<\/b>, \u043a\u0443\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <a href=\"http:\/\/developer.android.com\/intl\/ru\/reference\/android\/support\/v4\/view\/ActionProvider.html\">ActionProvider<\/a> \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:<br \/>  &#8212;<a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/ActionProvider.html#ActionProvider(android.content.Context)\">ActionProvider(Context context)<\/a> \u2013\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u043e\u043b\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445;<br \/>  &#8212;<a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/ActionProvider.html#onCreateActionView(android.view.MenuItem)\">onCreateActionView(MenuItem)<\/a> \u2013 \u0437\u0434\u0435\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0432\u044c\u044e\u0448\u043a\u0443 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0435\u043d\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e LayoutInflater, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0451;<br \/>  &#8212;<a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/ActionProvider.html#onPerformDefaultAction()\">onPerformDefaultAction()<\/a> \u2013 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u043f\u0443\u043d\u043a\u0442 \u0432 ActionBar.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 ActionProvider, \u0442\u043e \u041d\u0415 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043d\u0435\u0433\u043e \u0432 <b>onOptionsItemSelected()<\/b>, \u043d\u0443 \u0438\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u0430\u043c false, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u043d\u0430\u0447\u0435 <b>onPerformDefaultAction()<\/b> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 ActionProvider \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u043c\u0435\u043d\u044e, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/ActionProvider.html#hasSubMenu()\">hasSubMenu()<\/a> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c true. \u0422\u043e\u0433\u0434\u0430 \u0432\u043c\u0435\u0441\u0442\u043e <b>onPerformDefaultAction()<\/b> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/ActionProvider.html#onPrepareSubMenu(android.view.SubMenu)\">onPrepareSubMenu (SubMenu subMenu)<\/a>. \u0422\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0435 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0435 \u043f\u043e\u0434\u043c\u0435\u043d\u044e.<\/p>\n<h4>ShareActionProvider<\/h4>\n<p>  \u0412 Android \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 ActionProvider \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u2013 <a href=\"http:\/\/developer.android.com\/intl\/ru\/reference\/android\/support\/v7\/widget\/ShareActionProvider.html\">ShareActionProvider<\/a>. \u041a\u043e\u0433\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0435\u043d\u044e \u0441 \u043d\u0438\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 onCreateOptionsMenu \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v4\/view\/MenuItemCompat.html#getActionProvider(android.view.MenuItem)\">MenuItemCompat.getActionProvider(MenuItem)<\/a> \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v7\/widget\/ShareActionProvider.html#setShareIntent(android.content.Intent)\">setShareIntent()<\/a>, \u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c Intent \u0441 ACTION_SEND \u0438 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0451\u043d\u043d\u044b\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c:<\/p>\n<pre><code class=\"java\">private ShareActionProvider mShareActionProvider;  @Override public boolean onCreateOptionsMenu(Menu menu) {     getMenuInflater().inflate(R.menu.main_activity_actions, menu);      Intent share_intent = new Intent(Intent.ACTION_SEND);     intent.setType(&quot;image\/*&quot;);      mShareActionProvider = (ShareActionProvider)  getActionProvider(menu.findItem(R.id.action_share));     mShareActionProvider.setShareIntent(share_intent);      return super.onCreateOptionsMenu(menu); } <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u043b\u0438\u0441\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a), \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <b>setShareIntent()<\/b> \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<h4>\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f Activity<\/h4>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u041e\u0414\u041d\u041e\u0419 \u0434\u0440\u0443\u0433\u043e\u0439 Activity, \u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u043d\u0435\u0451 \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438 Up \u0432 ActionBar. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e: \u0432 \u0444\u0430\u0439\u043b\u0435 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0439 Activity \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"xml\">&lt;application ... &gt;     &lt;activity         android:name=&quot;com.you. app.MainActivity&quot; ...&gt; \/\/ \u0413\u043b\u0430\u0432\u043d\u0430\u044f Activity         ...     &lt;\/activity&gt;    ...     &lt;activity         android:name=&quot;com.you. app.DetailsActivity&quot;         android:label=&quot;@string\/title_activity_display_message&quot;         android:parentActivityName=&quot;com.example.myfirstapp.MainActivity&quot; &gt; \/\/\u0414\u043b\u044f API 16+         &lt;meta-data             android:name=&quot;android.support.PARENT_ACTIVITY&quot; \/\/ \u0414\u043b\u044f Support Library API 7+             android:value=&quot;com.you. app.MainActivity&quot; \/&gt;     &lt;\/activity&gt; &lt;\/application&gt; <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e\u0431\u044b \u043a\u043d\u043e\u043f\u043a\u0430 Home \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u043a\u0430\u043a Up, \u0432\u044b\u0437\u043e\u0432\u0438\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u044b SupportActionBar <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v7\/app\/ActionBar.html#setHomeButtonEnabled(boolean)\">setHomeButtonEnabled(true)<\/a> \u0438 <a href=\"http:\/\/developer.android.com\/reference\/android\/support\/v7\/app\/ActionBar.html#setDisplayHomeAsUpEnabled(boolean)\">setDisplayHomeAsUpEnabled(true)<\/a>. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043b\u044f API 11+<\/b><\/p>\n<div class=\"spoiler_text\">\u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e Android 3 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 MenuItemCompat \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0443 MenuItem, \u0432\u043c\u0435\u0441\u0442\u043e SupportActionBar \u2014 ActionBar. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432 \u043c\u0435\u043d\u044e \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 <b>android:<\/b>, \u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0430 <b>xmlns:yourapp=http:\/\/schemas.android.com\/apk\/res-auto<\/b> \u043d\u0435 \u043d\u0443\u0436\u043d\u0430.  <\/div>\n<\/div>\n<p>  \u0412\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432\u0437\u044f\u0442\u0430 <a href=\"http:\/\/developer.android.com\/intl\/ru\/guide\/topics\/ui\/actionbar.html\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a> (\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0433\u0430\u0439\u0434\u043b\u0430\u0439\u043d \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c).<\/p>\n<p>  <a href=\"http:\/\/habrahabr.ru\/post\/189680\/\">\u0427\u0430\u0441\u0442\u044c 1<\/a> \u2014 \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Support Library \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0438\u0441\u043a<br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/189678\/\">\u0427\u0430\u0441\u0442\u044c 2<\/a> \u2014 \u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u043a\u043b\u0430\u0434\u043e\u043a \u0438 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/189676\/\"> http:\/\/habrahabr.ru\/post\/189676\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412\u0441\u0435\u043c \u0434\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a!<\/p>\n<p>  \u041c\u0434\u0430, \u0434\u0430\u0432\u043d\u043e \u043d\u0435 \u043f\u0438\u0441\u0430\u043b \u044f \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u0425\u0430\u0431\u0440. \u0427\u0442\u043e \u0436, \u0431\u0443\u0434\u0443 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c.<br \/>  \u0412\u043e\u043e\u0431\u0449\u0435, ActionBar \u0432 Android \u2013 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430. \u0412 <a href=\"http:\/\/habrahabr.ru\/post\/189680\/\">\u043f\u0435\u0440\u0432\u043e\u0439<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/189678\/\">\u0432\u0442\u043e\u0440\u043e\u0439<\/a> \u0447\u0430\u0441\u0442\u044f\u0445 \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2013 \u043c\u0435\u043d\u044e \u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f. \u041d\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0434\u044c \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445: Split ActionBar, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 View \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0435\u043d\u044e \u0438 ActionProvider. \u041e \u043d\u0438\u0445 \u0438 \u043f\u043e\u0439\u0434\u0451\u0442 \u0440\u0435\u0447\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0431\u043e\u043d\u0443\u0441: \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u043d\u0430\u044e\u0442, \u0447\u0442\u043e \u043a\u043d\u043e\u043f\u043a\u0430 Up \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 Activity. \u041d\u043e \u0435\u0441\u043b\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u0434\u043d\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 Activity, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043a\u043e\u0434\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0432\u0432\u0435\u0440\u0445. \u0417\u0430\u0438\u043d\u0442\u0440\u0438\u0433\u043e\u0432\u0430\u043d\u044b? \u041f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-189676","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/189676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=189676"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/189676\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=189676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=189676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=189676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}