Official View Zoom uses the AnimatorSet to zoom in on the View . This creates the illusion of a downward movement as the gaze widens. Later, the AnimatorSet simply replayed to create the illusion of a decrease.
What I need to implement is the exact opposite. I need to start with an expanded view and reduce it to a smaller view with an upward movement:
It seems I cannot use the spread code in the example. This example assumes that you first zoom in and out, and then compress it back to the thumbnail.
Here is what I have tried so far. My xml layout
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#1999da"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:orientation="horizontal" android:layout_gravity="center" android:gravity="center"> <ImageView android:id="@+id/thumb_button_1" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_marginRight="1dp" android:visibility="invisible"/> </LinearLayout> </LinearLayout> <ImageView android:id="@+id/expanded_image" android:layout_width="wrap_content" android:layout_height="125dp" android:layout_gravity="center" android:src="@drawable/title_logo_expanded" android:scaleType="centerCrop"/> </FrameLayout>
And here is the method that performs the reduction operation. I basically tried changing the procedure in the tutorial:
private void zoomImageFromThumbReverse(final View expandedImageView, int imageResId, final int duration) {
I call this method in onCreate() as follows:
final View expandedImageView = findViewById(R.id.expanded_image); new Handler().postDelayed(new Runnable(){ public void run() { zoomImageFromThumbReverse(expandedImageView, R.drawable.title_logo_min, 1000); }}, 1000);
Good thing these guys. He does not work. I do not understand why. The demo works fine, so why doesn't it work? Take the gander and tell me if I'm crazy.
Can anyone recognize the mistake? Or point me in the right direction? All help would be greatly appreciated.
java android android-animation objectanimator viewpropertyanimator
YS Apr 28 '15 at 5:31 on 2015-04-28 05:31
source share