android - 以编程方式打开/关闭 ShapeDrawable (RectShape) 的闪烁/翻转动画/效果

标签 android draw shapedrawable

下面是绘制矩形所需的代码。不使用一些Runnables让它闪烁怎么可能呢?有没有办法做到这一点?或者也许我应该放一个闪烁的背景 gif?

ShapeDrawable ohMyShape = new ShapeDrawable(new RectShape());
ohMyShape.getPaint().setColor(Color.RED);
ohMyShape.getPaint().setStyle(Style.STROKE);
ohMyShape.setBounds(x, y, x+l, y+h);
ohMyShape.draw(canvas);

我的意思是类似

ohMyShape.getPain().setAnimation(Animation.BLINK);

真的会消除痛苦。

最佳答案

到目前为止,看起来最简单的方法是使用 2 张图像并将它们绘制在屏幕上。其中一张应该是闪烁的 gif,另一张是它的不闪烁版本。

感谢所有参与此独白的人。

关于android - 以编程方式打开/关闭 ShapeDrawable (RectShape) 的闪烁/翻转动画/效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11730304/

相关文章:

Android:如何做这个框架涂料?

c# - 如何绘制控件的圆形凸起和凹陷边缘?

android - ShapeDrawable 作为 Android 中 RatingBar 的 progressDrawable?

android - 在通知中使用 RatingBar

android - 在 android 的 AsyncTask 类中使用 sqlite 时出错?

java - Graphics2D.draw(Shape) 方法不准确

android - 我可以覆盖可绘制形状的某些属性吗?

android - 如何在 Google Maps API V2 中获取我的当前位置

android - 由于内存使用率高,应用程序崩溃

android - GradientDrawable绘制不同颜色的setColor方法