Two ways for Android to realize circular pictures

In the project, we often use circular pictures, but Android itself does not provide them, so I can only do it ourselves.

The first method is to customize the circleimageview:

When using, remember not to refer to the circleimageview under V4 report!!

Another article shares the second way: trim the picture into a circle, which gives us the same visual effect

We often use circular images, so whether to cut the images or customize the circular ImageView. If there are no special requirements, we must choose the former. The reason is very simple, because it is simple!! Directly on the source code, it is so rude and capricious~~~

Just enter the bitmap, and then return the circular bitmap to you, and then set it to the ImageView. Isn't it very simple.

Here's another point. If you take out bitmap from ImageView, you only need one line of code:

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.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>