[英]Android - Combination of Translate & Scale Layout
Hello I wouldlike to have animation from left to right , It should streatch portion from left to right , I have layout like this : http://postimg.org/image/vzjx7w5l3/ . 您好,我想从左到右制作动画,它应该从左到右伸展部分,我的布局是这样的: http ://postimg.org/image/vzjx7w5l3/。 When user clicks on Black area then it should stretch image like http://postimg.org/image/anp3efuyr/ .
用户单击“黑色”区域时,它应该拉伸http://postimg.org/image/anp3efuyr/之类的图像。
I have tried following xmls. 我尝试了以下xmls。
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromXDelta="1000"
android:toXDelta="0"
android:fromYDelta="0"
android:toYDelta="0"
android:duration="2000"
android:fillAfter="true" />
The above only move view from right to left only. 上面的视图仅从右向左移动。
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true">
<translate
android:fromXDelta="0%p"
android:toXDelta="75%p"
android:duration="800" />
The above only move from Right to left but donet stretch portrion 上面只是从右到左移动,但有donet拉伸部分
I have used combination : 我用过组合:
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true">
<translate
android:fromXDelta="0%p"
android:toXDelta="75%p"
android:duration="800" />
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toXScale="1.0"
android:toYScale="0.0" />
</set>
The above code move whole view to North East. 上面的代码将整个视图移至东北。
I am new to animation. 我是动画新手。 Any help will be appricoated.
任何帮助都会得到帮助。
Thanks 谢谢
Try to scale the view using fromXScale and toXScale. 尝试使用fromXScale和toXScale缩放视图。
<scale
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0"
android:toXScale="2.0"
android:fromYScale="1.0"
android:toYScale="1.0"
android:pivotX="0%"
android:pivotY="0%"
android:fillAfter="true"
android:duration="1000" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.