android - Programmatically turn on/off blink/flipper animation/effect for a ShapeDrawable (RectShape)
-
23-06-2021 - |
Question
Below is the code necessary to draw a rectangle. How would it be possible without using some Runnables to make it blink? Is there an option to make this? Or maybe I should put a blinking background 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);
I mean something like
ohMyShape.getPain().setAnimation(Animation.BLINK);
would really remove the pain.
Solution
Looks like the easiest way of doing this so far is, using 2 images and drawing them on the screen. One of these images should be a blinking gif and the the other is the not blinking version of it.
Thanks anybody who has participated in this monolog.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow