Reputation: 195
I am currently using ViewPropertyAnimators to scale an ImageView. However, the problem is that the image always scales outwards from the center, when I want it to scale from the leftmost edge and out towards the right. There does not seem to be a pivot method. Is there another way for me to do this?
Thank!
Upvotes: 4
Views: 894
Reputation: 2832
You need to set the android:transformPivotX
and android:transformPivotY
properties. For your specific case (left to right) something like that:
layout:
<View
android:id="@+id/view"
android:transformPivotX="0dp"
android:transformPivotY="5dp"
android:layout_width="100dp"
android:layout_height="10dp"
android:background="#00ffff"/>
java:
v.animate().scaleX(2.0f).setDuration(1000);
Upvotes: 4