开发者

Animation in a single file

开发者 https://www.devze.com 2023-04-03 09:52 出处:网络
I have the following animation for a button, for another button I need to a change few parameters. How do I do that in the same xml file. The f开发者_开发问答ollowing code is present in res/anim direc

I have the following animation for a button, for another button I need to a change few parameters. How do I do that in the same xml file. The f开发者_开发问答ollowing code is present in res/anim directory

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
 android:fromXDelta="300%" android:toXDelta="0%" android:fromYDelta="300%"
android:toYDelta="0%" android:duration="1000" android:zAdjustment="bottom" />


The best solution although cumbersome at first is to make each animation separate, in its own file. It may feel like duplicate code but after a while you will see that when you're changing settings in different place just to get the right effect then you'll be glad you didn't tie the two widget animations together.

0

精彩评论

暂无评论...
验证码 换一张
取 消