objectanimator

公共技术点之 Android 动画基础

让人想犯罪 __ 提交于 2019-12-03 00:37:54
一 传统 View 动画(Tween/Frame) 1.1 Tween 动画 主要有 4 中:缩放、平移、渐变、旋转 文件位置: res/anim/filename.xml 编译资源的数据类型:an Animation 资源引用: Java: R.anim.filename XML: @[package:]anim/filename <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@[package:]anim/interpolator_resource" android:shareInterpolator=["true" | "false"] > <alpha android:fromAlpha="float" android:toAlpha="float" /> <scale android:fromXScale="float" android:toXScale="float" android:fromYScale="float" android:toYScale="float" android:pivotX="float" android:pivotY="float" />

安卓动画学习(四) ---PropertyValuesHolder的介绍

匿名 (未验证) 提交于 2019-12-03 00:19:01
public static ObjectAnimator ofPropertyValuesHolder(Object target ,PropertyValuesHolder... values) PropertyValuesHolder public static PropertyValuesHolder ofFloat (String propertyName, float ... values) { return new FloatPropertyValuesHolder(propertyName, values); } private static final HashMap <Class, HashMap < String , Long>> sJNISetterPropertyMap = new HashMap <Class, HashMap < String , Long>>(); long mJniSetter; private FloatProperty mFloatProperty; Keyframes.FloatKeyframes mFloatKeyframes; float mFloatAnimatedValue; public static ObjectAnimator ofPropertyValuesHolder(Object target

拖动销毁图片参考代码

我只是一个虾纸丫 提交于 2019-12-02 08:06:16
package com.jiayiworld.baselibrary.widgets; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; import androidx.annotation.NonNull; import static android.animation.ObjectAnimator.ofFloat; /** * 仿今日头条图片浏览上下滑动退出界面 */ public class UpDownHideLayout extends FrameLayout { private ScrollListener mScrollListener; // 最小缩放比例 private final float MIN_SCALE =

Object animator not removing update listener android

元气小坏坏 提交于 2019-12-02 07:38:33
Good day.I have an scenario where this half normal object animator keeps firing over and over causing heap grow and ofcourse out of memory issue at some point.Here is how it go. I have made static method for rainbow animation like this. public static ObjectAnimator startRainbowAnimation(Context context, String textToShow, final TextView textViewToAttach) { AnimatedColorSpan span = new AnimatedColorSpan(context); final SpannableString spannableString = new SpannableString(textToShow); String substring = textToShow; int start = textToShow.indexOf(substring); int end = start + substring.length();

Android动画-1

梦想的初衷 提交于 2019-12-02 06:23:36
Android动画 目录 Android视图动画 Android属性动画 Android布局动画 Interpolators(插值器) 1.Android视图动画 介绍 视图动画使用简单,效果丰富,它提供了 AlphaAnimation、RotateAnimation、TranslateAnimation、ScaleAnimation 四种动画方式,并提供了AnimationSet动画集合,混合使用多种动画 优点 效率高、使用方便 缺点 不具备交互性 透明度动画 // 参数表示透明度从0变到1 AlphaAnimation alphaAnimation = new AlphaAnimation ( 0 , 1 ) ; alphaAnimation . setDuration ( 1000 ) ; 旋转动画 // 从左到右依次是x和y从哪个角度旋转到哪个角度,相对于自身x、y的中心点进行旋转 TranslateAnimation translateAnimation = new TranslateAnimation ( 0 , 40 , 0 , 40 , Animation . RELATIVE_TO_SELF , 0.5f , Animation . RELATIVE_TO_SELF , 0.5f ) ; translateAnimation . setDuration (

Attempt to invoke interface method 'void android.support.v7.widget.DecorContentParent.setWindowCallback(android.view.Window$Callback)'

☆樱花仙子☆ 提交于 2019-12-01 16:57:11
here is my project: animated_path.xml: <?xml version="1.0" encoding="utf-8"?> <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:drawable="@drawable/triangle" tools:targetApi="21"> <target android:name="t" android:animation="@animator/path"/> </animated-vector> path.xml: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator android:duration="3000" android:propertyName="pathData" android:repeatCount="infinite" android:repeatMode="reverse" android

How to animate marker on google maps ?

独自空忆成欢 提交于 2019-12-01 08:06:01
What i'm trying to achieve supposed to be very simple, yet it's not working. I have added a marker on my map, and i'm trying to animate it an heart beat. I have tried the following code, but without no luck, ObjectAnimator pulse = ObjectAnimator.ofPropertyValuesHolder(userLocation, PropertyValuesHolder.ofFloat("scaleX",2f), PropertyValuesHolder.ofFloat("scaleY",2f) ); pulse.setDuration(310); pulse.setRepeatCount(ObjectAnimator.INFINITE); pulse.setRepeatMode(ObjectAnimator.REVERSE); pulse.start(); any suggestion would be grateful, plus using an external library can be an option as well, I have

Android Property Animation

对着背影说爱祢 提交于 2019-12-01 03:04:48
<objectAnimator android:propertyName="string" android:duration="int" android:valueFrom="float | int | color" android:valueTo="float | int | color" android:startOffset="int" android:repeatCount="int" android:repeatMode=["repeat" | "reverse"] android:valueType=["intType" | "floatType"]/> Ok I am learning some Animation in android. I got it from Google Developer Docs two attributes that actually I am not able to understand are android:propertyName="string" android:valueType=["intType" | "floatType"] Some of the values make sense "fade", "rotation", "alpha" But what about others like endYear,

Can't get objectAnimator working with xFraction

荒凉一梦 提交于 2019-11-30 09:37:21
问题 I'm trying to animate a slide-in/slide-out animation between Fragments . I know there're tons of similiar question out there on StackOverflow , but believe me - I tried all of them and none is working. Following my code (basically taken from similiar questions): Custom Layout public class SlidingFrameLayout extends FrameLayout { public SlidingFrameLayout(Context context) { super(context); } public SlidingFrameLayout(Context context, AttributeSet attrs) { super(context, attrs); } public float

Attempt to invoke interface method 'void android.support.v7.widget.DecorContentParent.setWindowCallback(android.view.Window$Callback)'

房东的猫 提交于 2019-11-30 09:14:35
问题 here is my project: animated_path.xml: <?xml version="1.0" encoding="utf-8"?> <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:drawable="@drawable/triangle" tools:targetApi="21"> <target android:name="t" android:animation="@animator/path"/> </animated-vector> path.xml: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator android:duration="3000"