-
alpha
: Changes the layer's opacity -
x
,y
,translationX
,translationY
: Changes the layer's position -
scaleX
,scaleY
: Changes the layer's size -
rotation
,rotationX
,rotationY
: Changes the layer's orientation in 3D space -
pivotX
,pivotY
: Changes the layer's transformations origin
These properties are the names used when animating a view with an ObjectAnimator
. If you want to access these properties, call the appropriate setter or getter. For instance, to modify the alpha property, call setAlpha()
. The following code snippet shows the most efficient way to rotate a viewiew in 3D around the Y-axis:
view.setLayerType(View.LAYER_TYPE_HARDWARE, null); ObjectAnimator.ofFloat(view, "rotationY", 180).start();
Because hardware layers consume video memory, it is highly recommended that you enable them only for the duration of the animation and then disable them after the animation is done. You can accomplish this using animation listeners:
View.setLayerType(View.LAYER_TYPE_HARDWARE, null); ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotationY", 180); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.setLayerType(View.LAYER_TYPE_NONE, null); } }); animator.start();
For more information on property animation, see Property Animation.
'Android' 카테고리의 다른 글
android memory (0) | 2013.11.06 |
---|---|
How can I get the cookies from HttpClient? (0) | 2013.11.01 |
How to use Jackson to deserialise an array of objects (0) | 2013.10.31 |
Endless Scrolling ListView in Android (0) | 2013.10.31 |
EditText / TextView 속성 [출처] EditText / TextView 속성 (0) | 2013.10.16 |