I want to achieve a dynamic effect through multiple pictures, but in the process of using it, I found that when the display performs requestRender, the previous picture will not be deleted. How can I clear the previous picture when rendering
Hi guankai,
I am not sure what effect you are trying to achieve. I guess that you want to have one blue image displayed at a time and all others images are grey, is that right? Like below?
Would you share the rendering code?
Thank you,
Thomas
Hi Thomas
It may be that the example I gave is not clear enough. I will change it to another example, as shown in the figure, I use these pictures to represent the oil amount of the car. When the oil amount is reduced to the specified value range, I will replace the corresponding picture to display the corresponding oil. The current problem is that when I update the picture, the picture corresponding to the previous oil amount is not refreshed or deleted. What I want to ask is, is there a corresponding way to delete the picture from the last render?
Hello guankai,
My guess is that your widget has a transparent background in its style attributes.
A solid background (like ej.mwt.style.background.RectangularBackground
) allows for “cleaning” the widget area by erasing the pixels of any previous rendering: it basically fills the widget area with a given color.
On the other hand, a transparent background (i.e., ej.mwt.style.background.NoBackground
) does nothing, so the drawings of the widget renderContent()
overlap with the content already on screen.
So, if the rendering of your widget does not erase/cover the content of the previous rendering, it could be because the style applied to your widget uses a NoBackground
as background. Check if your widget and its parents use NoBackground
(look for style.setBackground(NoBackground.NO_BACKGROUND
) in your style definition).
You could also check if the default style of your stylesheet uses the NoBackground
(see the default style retrieved from ej.mwt.stylesheet.cascading.CascadingStylesheet.getDefaultStyle()
).
Best regards,
Thomas