Fillet image generation method in Android

This paper describes the fillet image generation method in Android. Share with you for your reference. The specific analysis is as follows:

In Android development, in order to be beautiful, the effect of fillet image is often required to be displayed in ImageView. How to achieve this?

Here is a summary of the best method on the Internet: process the image into rounded corners, and then load it to ImageView for display. The code is as follows:

Attach a renderings:

There is no problem with this method. However, if the loaded image is too large, this method takes time. In this way, for a large number of imageviews, the refresh will be stuck or flickered. How to solve this problem?

In my opinion, if this is the case, we can only abandon this method. Second, we can build two layers of ImageView. The first layer is the original square corner image a, and the second layer is a special resource image B. its size is the same as the original image. Assuming that the fillet image obtained by a according to the above method is C, then define the image t = a-c, Then we change t to the background color we need, so B = t (background color). The final effect is that a is below, B is above, the four corners are rounded, and the square corner image is covered under B. This eliminates the time-consuming problem caused by direct image processing. However, if the image size is small and the number is small, I still suggest using the first method. After all, the effect of the original is good, and piracy is still piracy, ha ha!

I hope this article will be helpful to your Android program design.

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
分享
二维码
< <上一篇
下一篇>>