Android 缩放动画使视图在动画开始之前缩短
所以我有这个缩放动画,它应该做的是将视图缩放到全高的70%,然后将其缩放回原始大小。我有两个不同StartOffset的缩放动画 我遇到的问题是,在动画开始之前视图会缩放。因此,当动画开始时,它们将使用已缩短的缩放视图 以下是我的动画xml:Android 缩放动画使视图在动画开始之前缩短,android,animation,scale,Android,Animation,Scale,所以我有这个缩放动画,它应该做的是将视图缩放到全高的70%,然后将其缩放回原始大小。我有两个不同StartOffset的缩放动画 我遇到的问题是,在动画开始之前视图会缩放。因此,当动画开始时,它们将使用已缩短的缩放视图 以下是我的动画xml: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:fill
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator" >
<scale
android:duration="300"
android:fillAfter="true"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:startOffset="200"
android:toXScale="1.0"
android:toYScale="0.7"
/>
<scale
android:duration="300"
android:fillAfter="true"
android:fromXScale="1.0"
android:fromYScale="0.7"
android:startOffset="1000"
android:toXScale="1.0"
android:toYScale="1.0"
/>
</set>
有什么想法吗?感谢阅读。取决于评论中的@pskink通知 如果动画具有循环模式,则只能将
android:interpolator
属性设置为@android:anim/cycle\u interpolator”
因此,您只能使用第一阶段,然后将返回原始状态
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/cycle_interpolator" >
<scale
android:duration="300"
android:fillAfter="true"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:startOffset="200"
android:toXScale="1.0"
android:toYScale="0.7" />
</set>
取决于评论中的@pskink通知 如果动画具有循环模式,则只能将
android:interpolator
属性设置为@android:anim/cycle\u interpolator”
因此,您只能使用第一阶段,然后将返回原始状态
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/cycle_interpolator" >
<scale
android:duration="300"
android:fillAfter="true"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:startOffset="200"
android:toXScale="1.0"
android:toYScale="0.7" />
</set>
在域0中使用一个缩放动画和一个自定义插值器的作用类似于/\或类似于sin()函数。.p在域0中使用一个缩放动画和一个自定义插值器的作用类似于/\或类似于sin()函数。.p哦,这更有意义。谢谢。@MohamedZaatari这不是它应该如何使用的,你应该使用插值器使其工作,请尝试使用CycleInterpolatorexample@pskink插值器用于控制缩放加速度,而不是控制可以阅读的有关插值器的位置property@MohamedZaatari“这允许基本的动画效果(阿尔法、缩放、平移、旋转)加速、减速、重复等。”OP的问题是这样的:动画重复一次并反转,只需使用CycleInterpolator即可实现,而不是像1/0这样神奇的东西。7@pskink你是对的,我会用你有用的信息更新我的答案…谢谢,这更有意义。谢谢。@MohamedZaatari这不是应该使用的方式,你应该使用Interpola要使其工作,请尝试使用CycleInterpolatorexample@pskink插值器用于控制缩放加速度,而不是控制可以阅读的有关插值器的位置property@MohamedZaatari这允许基本动画效果(alpha、缩放、平移、旋转)被加速、减速、重复等OP的问题是这样的:动画重复一次并反转,只需使用CycleInterpolator即可实现,而不是像1/0这样神奇的东西。7@pskink你是对的,我会用你的有用信息更新我的答案…谢谢
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator" >
<scale
android:duration="300"
android:fillAfter="true"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:startOffset="200"
android:toXScale="1.0"
android:toYScale="0.7"
/>
<scale
android:duration="300"
android:fillAfter="true"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:startOffset="1000"
android:toXScale="1.0"
android:toYScale="1.42"
/>
</set>