在风景和肖像活动之间滑动动画

时间:2016-11-14 05:52:55

标签: android android-animation

我有两个活动ActivityA和ActivityB。 ActivityA处于纵向模式,ActivityB处于横向模式。我想在这两个活动之间实现幻灯片动画。我试过下面的代码,但它没有用。

enter.xml

//Getting the card view array list from the adapter above
ArrayList<CardView> cardViewArrayList = adapter.getCardViewList();
                for (int i = 0; i < cardViewArrayList.size(); i++)
                {
                    // Iterate till the last of the array list and add each view individually to the document.
                    addContent(document, cardViewArrayList.get(i));
                }

//Adding the content to the document
private void addContent(Document document, View view)
            throws DocumentException
    {
        try
        {
            view.buildDrawingCache();

            Bitmap bmp = view.getDrawingCache();

            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
            Image image = Image.getInstance(stream.toByteArray());
            image.scalePercent(70);
            image.setAlignment(Image.MIDDLE);
            document.add(image);
        }
        catch (Exception ex)
        {
            Log.e("TAG-ORDER PRINT ERROR", ex.getMessage());
        }
    }

exit.xml

    <?xml version="1.0" encoding="utf-8"?>
   <set xmlns:android="http://schemas.android.com/apk/res/android"
      android:shareInterpolator="false">
      <translate
          android:duration="500"
          android:fromXDelta="100%"
          android:fromYDelta="0%"
          android:toXDelta="0%"
          android:toYDelta="0%" />
   </set>

活动转换的活动代码

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false">
    <translate
        android:duration="500"
        android:fromXDelta="0%"
        android:fromYDelta="0%"
        android:toXDelta="-100%"
        android:toYDelta="0%" />
</set>

0 个答案:

没有答案