[英]Getting alpha/opacity of a View in Android
How can I get the alpha/opacity of a View
after I've animated it? 在动画制作后,如何获得
View
的alpha / opacity?
My fadeIn()
is below - fadeOut()
is the same with the endpoints switched. 我的
fadeIn()
低于 - fadeOut()
与切换的端点相同。
public void fadeIn(View view) {
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(1000);
animation.setFillAfter(true);
view.startAnimation(animation);
}
I would highly recommend you to define the animations in an XML-file. 我强烈建议您在XML文件中定义动画。 The API doesn't have support for getting a specific alpha.
API不支持获取特定的alpha。
You can still have in mind that the opacity that your view has, is the last one you've defined; 您仍然可以记住,您的视图具有的不透明度是您定义的最后一个; in this case, (your
fadeIn()
method), your latest opacity value is the value you passed into the AlphaAnimation
constructor. 在这种情况下,(您的
fadeIn()
方法),您的最新不透明度值是您传递给AlphaAnimation
构造函数的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.