Android uses itemdecoration to add watermarks to recyclerview
@H_ 502_ 1 @ Preface
Watermark effect is used in the project, as shown in the figure below. In the implementation process, itemdecoration is finally selected for implementation, including two steps: Customizing drawable to complete the watermark image and using itemdecoration to layout the watermark.
The demo is in watermarkfragment, and the effect diagram is as follows:
1. Customize drawable to complete the watermark image
Here, it's easy to customize the drawable, but it's much easier to think of this step. At first, I wanted to draw the layout directly in itemdecoration, but later I tried it. It was too complex, so I used drawable independently, and then it went much better.
2. Use itemdecoration layout watermark
In recyclerview:
@H_ 502_ 1 @ conclusion
It's still very simple to write it down. It's really difficult to implement it at the beginning. Recyclerview is really well written. It's an artistic control.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.