Android ImageView循环颜色

发布于 2024-11-15 18:07:04 字数 417 浏览 6 评论 0原文

我想快速循环在图像视图中加载的图像的色调。这就是我目前所拥有的。我还为 myimage 使用透明背景色。但这不起作用。

    AlphaAnimation transparency = new AlphaAnimation(1, 9);
    transparency.setRepeatCount(Animation.INFINITE);
    transparency.start();

    ImageView myimage = (ImageView) findViewById(R.id.myimageid);
    myimage.setBackgroundColor(0x66F00000);
    myimage.startAnimation(transparency);

什么才能使其正常工作?

I would like to quickly cycle the tint of an image that I have loaded within an imageview. This is what I currently have. I am also using a transparent background color for myimage. This does not work though.

    AlphaAnimation transparency = new AlphaAnimation(1, 9);
    transparency.setRepeatCount(Animation.INFINITE);
    transparency.start();

    ImageView myimage = (ImageView) findViewById(R.id.myimageid);
    myimage.setBackgroundColor(0x66F00000);
    myimage.startAnimation(transparency);

What will make this work properly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风蛊 2024-11-22 18:07:04

来自参考:

参数

fromAlpha 动画的起始 Alpha 值,其中 1.0 表示完全不透明,0.0 表示完全透明

假设您想要从 10% 到 90% 进行动画处理,则需要将参数设置为 new AlphaAnimation(0.1f, 0.9f);

From the reference:

Parameters

fromAlpha Starting alpha value for the animation, where 1.0 means fully opaque and 0.0 means fully transparent.

Assuming you want to animate from 10% to 90%, you need to set the parameters as new AlphaAnimation(0.1f, 0.9f);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文