Android uses shape to realize various simple shapes

1、 Overview

We often use pictures in Android development, and some simple pictures can be replaced by shape drawable resources. One advantage of using shape is that it can reduce the size of our APK. Because of the same effect, shape saves more space than pictures. Well, we don't talk much. Let's get to the point.

2、 Shape acquaintance

Shape is an important role in Android drawable resources. Drawable resources cover a wide range. It not only represents pictures, but also can be a color and a shape. Because shape is simple and practical, let's take a look at the classification of shape shapes:

ectangle:

Rectangle represents rectangle, which is the default shape type of shape. That is, if we do not specify its type in the Android: shape property of shape, it is rectangle by default. With it, we can draw a rectangle, rounded rectangle, which will be described below

oval:

Ovel, ellipse, it can be used to draw ellipses and circles

line:

Horizontal line. When using the shape, we have to specify the stroke element and its width, otherwise a null pointer exception will be reported when using the shape

ring:

annular

Now let's use the above shapes to draw graphics and create various simple shapes

3、 Use of shape

Let's take a look at some simple shapes drawn with shape. Then I'll talk about various properties of shape and some problems to pay attention to according to the shapes:

1. Solid rectangle

2. Colorful solid rectangle

3. Rectangular outer frame

4. Dotted rectangular outer frame

5. Oval dotted line outer frame

6. Solid box fillet

seven

eight

nine

ten

eleven

twelve

thirteen

fourteen

fifteen

sixteen

seventeen

eighteen

nineteen

twenty

twenty-one

twenty-two

twenty-three

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. Thank you for your support for 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
分享
二维码
< <上一篇
下一篇>>