android– 如何在xml anim文件中指定fromXType属性

android– 如何在xml anim文件中指定fromXType属性,第1张

概述我想在xml和代码中制作相同的动画.我编码我有这个Animationa=newTranslateAnimation(Animation.RELATIVE_TO_PARENT,1.1f,Animation.RELATIVE_TO_PARENT,-0.2f,Animation.RELATIVE_TO_PARENT,0.0f,Animation.RELATIVE_TO_PARENT,0.0f);我从我的xml

我想在xml和代码中制作相同的动画.
我编码我有这个

    Animation a = new TranslateAnimation(Animation.relative_TO_PARENT , 1.1f, Animation.relative_TO_PARENT, -0.2f,            Animation.relative_TO_PARENT, 0.0f, Animation.relative_TO_PARENT, 0.0f);

我从我的xml anim文件开始,但我不知道如何让他知道翻译应该是相对于父级的

<translate    androID:duration="2500"    androID:fromXDelta="-0.1"    androID:fromYDelta="0"    androID:toXDelta="200"    androID:toYDelta="0" />

即我不知道如何指定fromXType属性

fromXType指定如何解释fromXValue. Animation.absolute,Animation.relative_TO_SELF或Animation.relative_TO_PARENT之一.

解决方法:

你需要像这样使用P参数

androID:fromXDelta="-0.1%p"

read here

总结

以上是内存溢出为你收集整理的android – 如何在xml anim文件中指定fromXType属性全部内容,希望文章能够帮你解决android – 如何在xml anim文件中指定fromXType属性所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1116372.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存