{"id":196224,"date":"2013-10-03T14:42:07","date_gmt":"2013-10-03T10:42:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=196224"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=196224","title":{"rendered":"<span class=\"post_title\">\u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u044b\u0445 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 Activity \u0432 \u041e\u0421 Android<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c! \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 Activity \u0432 Android \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 ObjectAnimator \u0438 AnimatorSet. \u0412\u0441\u0435\u043c, \u043a\u043e\u043c\u0443 \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442. <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/fe2\/fc6\/4dc\/fe2fc64dc68269c628004a519070e96b.png\"\/><br \/>  PS: \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/ra1ph\/ActivityAnimationExample\">GitHub <\/a><\/p>\n<p>  \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c 2 \u0432\u0438\u0434\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u044b\u0445 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439:  <\/p>\n<ul>\n<li>\u0430\u043d\u0438\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u0440\u0443\u044e Activity \u043d\u0430 \u0444\u043e\u043d\u0435 \u043d\u043e\u0432\u043e\u0439<\/li>\n<li>\u0430\u043d\u0438\u043c\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u0443\u044e Activity \u043d\u0430 \u0444\u043e\u043d\u0435 \u0441\u0442\u0430\u0440\u043e\u0439<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0431\u044b\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u044b 2 \u0442\u0438\u043f\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438: \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0441\u0442\u0432\u043e\u0440\u043a\u0438 \u0434\u0432\u0435\u0440\u0438) \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0441\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0441\u0442\u0430 \u0431\u0443\u043c\u0430\u0433\u0438)<\/p>\n<h4>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u0440\u043e\u0439 Activity<\/h4>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/181\/eb3\/789\/181eb3789605c071b1b5a59eb193e136.png\"\/><br \/>  \u0418\u0442\u0430\u043a, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c 3 Activity: FirstActivity, SecondActivity \u0438 ThirdActivity.<\/p>\n<p>  \u041a\u043e\u0434 FirstActivity:<\/p>\n<p>  first.xml:  <\/p>\n<pre><code class=\"xml\">&lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;               android:id=&quot;@+id\/click_layout&quot;               android:orientation=&quot;vertical&quot;               android:layout_width=&quot;fill_parent&quot;               android:layout_height=&quot;fill_parent&quot;               android:background=&quot;#00ff00&quot;         &gt;     &lt;TextView             android:layout_gravity=&quot;center&quot;             android:gravity=&quot;center&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;fill_parent&quot;             android:textColor=&quot;#FFFFFF&quot;             android:textSize=&quot;40sp&quot;             android:text=&quot;First&quot;             \/&gt; &lt;\/LinearLayout&gt; <\/code><\/pre>\n<p>  FirstActivity.java:  <\/p>\n<pre><code class=\"java\">public class FirstActivity extends Activity {          @Override     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.first);          LinearLayout click = (LinearLayout) findViewById(R.id.click_layout);         click.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View v) {                 Bitmap bmp = getBitmap();                  ByteArrayOutputStream stream = new ByteArrayOutputStream();                 bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);                 byte[] byteArray = stream.toByteArray();                 Intent intent = new Intent(FirstActivity.this, SecondActivity.class);                 intent.putExtra(&quot;picture&quot;, byteArray);                 startActivity(intent);                 overridePendingTransition(0,0);             }         });     }      private Bitmap getBitmap(){         View root = getWindow().getDecorView().findViewById(android.R.id.content);         root.setDrawingCacheEnabled(true);         return root.getDrawingCache();     } } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f getBitmap \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 Bitmap \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043e\u043a\u043d\u0430. \u041f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 Activity \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 Intent, \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 Extra \u0437\u0430\u0434\u0430\u0435\u043c \u043d\u0430\u0448 Bitmap, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c SecondActivity.<\/p>\n<p>  \u041a\u043e\u0434 SecondActivity:<\/p>\n<p>  second.xml:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;FrameLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;               android:orientation=&quot;vertical&quot;               android:layout_width=&quot;fill_parent&quot;               android:layout_height=&quot;fill_parent&quot;               android:id=&quot;@+id\/click_layout&quot;               android:background=&quot;#ff0000&quot;         &gt;     &lt;TextView             android:layout_gravity=&quot;center&quot;             android:gravity=&quot;center&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;fill_parent&quot;             android:textColor=&quot;#FFFFFF&quot;             android:textSize=&quot;40sp&quot;             android:text=&quot;Second&quot;             \/&gt;     &lt;LinearLayout android:orientation=&quot;horizontal&quot;                   android:weightSum=&quot;100&quot;             android:layout_width=&quot;fill_parent&quot;                android:layout_height=&quot;fill_parent&quot;&gt;         &lt;ImageView android:layout_weight=&quot;50&quot;                    android:layout_width=&quot;0dip&quot;                    android:layout_height=&quot;fill_parent&quot;                 android:id=&quot;@+id\/left_image&quot;\/&gt;         &lt;ImageView android:layout_weight=&quot;50&quot;                    android:layout_width=&quot;0dip&quot;                    android:layout_height=&quot;fill_parent&quot;                    android:id=&quot;@+id\/right_image&quot;\/&gt;             &lt;\/LinearLayout&gt; &lt;\/FrameLayout&gt; <\/code><\/pre>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u0448\u0435\u0439 Activity \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c FrameLayout, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 2 LinearLayout. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442(\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e TextView). \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f 2 ImageView, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u044f\u0442 \u044d\u043a\u0440\u0430\u043d \u043f\u043e\u043f\u043e\u043b\u0430\u043c. \u041e\u043db \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u043d\u0430\u043c \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438. <\/p>\n<p>  \u0414\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c Bitmap \u0438\u0437 \u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u043e\u0439 Activity<\/li>\n<li>\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c Bitmap \u043d\u0430 2 \u0447\u0430\u0441\u0442\u0438 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 ImageView<\/li>\n<li>\u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 AnimatorSet \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u043e\u0431\u043e\u0438\u0445 ImageView<\/li>\n<\/ol>\n<pre><code class=\"java\">public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.second);          Bundle extras = getIntent().getExtras();         byte[] byteArray = extras.getByteArray(&quot;picture&quot;);          Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);         left = (ImageView) findViewById(R.id.left_image);         right = (ImageView) findViewById(R.id.right_image);         int centerWidth = bmp.getWidth()\/2;         Bitmap bmpLeft,bmpRight;         bmpLeft = Bitmap.createBitmap(bmp,0,0,centerWidth,bmp.getHeight());         bmpRight = Bitmap.createBitmap(bmp,centerWidth,0,bmp.getWidth() - centerWidth,bmp.getHeight());          left.setImageBitmap(bmpLeft);         right.setImageBitmap(bmpRight);          ViewTreeObserver observer = left.getViewTreeObserver();         observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {             @Override             public boolean onPreDraw() {                 left.getViewTreeObserver().removeOnPreDrawListener(this);                 startEnterAnimation();                 return true;  \/\/To change body of implemented methods use File | Settings | File Templates.             }         });     } <\/code><\/pre>\n<p>  \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 onCreate \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c Bitmap \u0438\u0437 Extras, \u0434\u0435\u043b\u0438\u043c \u0435\u0433\u043e \u043d\u0430 2 Bitmap \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Bitmap.createBitmap() \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 ImageView. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c Observer, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 onDraw \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c ImageView \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0432\u043e\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0412 \u043d\u0435\u043c \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f Activity.<\/p>\n<pre><code class=\"java\">private void startEnterAnimation() {         left.setPivotY(left.getHeight()\/2);         left.setPivotX(0);         right.setPivotY(left.getHeight()\/2);         right.setPivotX(right.getWidth());         Animator leftAnim = ObjectAnimator.ofFloat(left, &quot;rotationY&quot;, 0, 90);         Animator rightAnim = ObjectAnimator.ofFloat(right, &quot;rotationY&quot;, 0, -90);         AnimatorSet set = new AnimatorSet();         set.setDuration(500);         set.playTogether(leftAnim, rightAnim);         set.start();     } <\/code><\/pre>\n<p>  \u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 startEnterAnimation(). \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 setPivotX() \u0438 setPivotY() \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0438, \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u0441\u0430\u043c\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 ObjectAnimator.<br \/>  ObjectAnimator \u2014 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0441 Android 3.0. \u041e\u043d \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043b\u044e\u0431\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u044b \u0430\u043d\u0438\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e rotationX \u0442\u0438\u043f\u0430 float \u043e\u0431\u044a\u0435\u043a\u0442\u0430 left. <br \/>  \u0414\u0430\u043b\u0435\u0435, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 AnimatorSet, \u0437\u0430\u0434\u0430\u0435\u043c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432 500 \u043c\u0441 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0435\u043c\u0443, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c 2 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438.<br \/>  \u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f Activity \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e. \u0414\u043b\u044f \u0435\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e Activity onBackPressed(). \u0412 \u043d\u0435\u0439 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c listener \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 finish().<\/p>\n<h4>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0439 Activity<\/h4>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/342\/f1f\/6f3\/342f1f6f308242ccb8b9e26bef6506eb.png\"\/><br \/>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e Activity \u043d\u0430 \u0444\u043e\u043d\u0435 \u0441\u0442\u0430\u0440\u043e\u0439, \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043d\u043e\u0432\u0443\u044e Activity. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0444\u043e\u043d ACtivity \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b\u0435 AndroidManifest \u0442\u0435\u043c\u0443 ThirdActivity \u043d\u0430 Transparent, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u0432 styles.xml<\/p>\n<pre><code class=\"xml\">&lt;style name=&quot;Transparent&quot;&gt;         &lt;item name=&quot;android:windowNoTitle&quot;&gt;true&lt;\/item&gt;         &lt;item name=&quot;android:windowIsTranslucent&quot;&gt;true&lt;\/item&gt;         &lt;item name=&quot;android:windowBackground&quot;&gt;@android:color\/transparent&lt;\/item&gt;     &lt;\/style&gt; <\/code><\/pre>\n<p>  \u0421\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c:  <\/p>\n<ul>\n<li>\u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u0435\u043b\u044f OnPreDrawListener \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 getBitmap \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c Bitmap \u043d\u0430\u0448\u0435\u0433\u043e Layout, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f Activity<\/li>\n<li>\u0434\u0435\u043b\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 Bitmap \u043d\u0430 4 \u0447\u0430\u0441\u0442\u0438, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 Bitmap, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u043c\u0438 \u0432\u0441\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u0440\u043e\u043c\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e<\/li>\n<li>\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0443\u0441\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u044b\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u0443\u0441\u043e\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>\u043d\u0443 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u0441\u0435\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0438\u0434\u0438\u043c\u044b\u043c Layout \u0441 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u0432 \u044d\u0442\u043e\u0439 Activity, \u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u043c<\/li>\n<\/ul>\n<p>  \u0412\u0441\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u0441\u0435 \u0442\u043e\u0433\u043e-\u0436\u0435 AnimatorSet, \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u043d\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 playSequentially. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c.<\/p>\n<p>  \u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f Activity \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 2 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 Activity. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0434 \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u044b\u0448\u0435 3.0, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 1.6, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/JakeWharton\/NineOldAndroids\">NineOldAndroids<\/a> \u043e\u0442 \u0432\u0441\u0435\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e Jake Wharton&#8217;\u0430. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u043e \u0447\u0435\u043c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0437\u0430\u043e\u0441\u0442\u0440\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u043d\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0434\u043b\u044f \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043e\u043d\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 AnimatorProxy.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0443 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u0442\u0435\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 \u0432 \u041e\u0421 Android. \t\t\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\/196224\/\"> http:\/\/habrahabr.ru\/post\/196224\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c! \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 Activity \u0432 Android \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 ObjectAnimator \u0438 AnimatorSet. \u0412\u0441\u0435\u043c, \u043a\u043e\u043c\u0443 \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442. <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/fe2\/fc6\/4dc\/fe2fc64dc68269c628004a519070e96b.png\"\/><br \/>  PS: \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.  <\/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-196224","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/196224","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=196224"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/196224\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=196224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=196224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=196224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}