Android custom ImageView to add layer effect on the picture
First, let's look at the renderings
Realization idea
These are two front and rear comparison pictures. The second picture on the right shows the robbed label pictures when there are no goods. In the center of each picture, the first idea is to set another layer of relativelayout on the outer layer of ImageView
Implementation method
Of course, this is OK. However, if the XML layout itself is very complex, it is not elegant to add a layer to the view tree in this way. Here is another implementation method: custom view
In XML:
Get the centerimage object in the code:
When the invalidate () method in setcenterimgshow () is called, the OnDraw () method of centerimage will be called again and redrawn, so that you can happily add a new layer on the ImageView.
summary
The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. If you have any questions, you can leave a message.