I have no intention of discovering a good xml layout for drawing background images in android today! Shape. Using shape can replace the previous background image search! A picture shows the effect.
This background is drawn using shape. A few lines of code can be done. I personally feel much better than using images.
Create a shape xml
In the drawable folder. Select drawable when creating android xml. The following figure shows a shape selection.
Gradient is the gradient of the color, and corners is the rounded corner of the edge.
[Html]
<? Xml version = "1.0" encoding = "UTF-8"?>
<Shape xmlns: android = "http://schemas.android.com/apk/res/android"
Android: shape = "rectangle"
>
<Gradient
Android: startColor = "#151F28"
Android: endColor = "#375974"
Android: angle = "90"
>
</Gradient>
<Corners
Android: bottomLeftRadius = "15dp"
Android: bottomRightRadius = "15dp"
Android: topLeftRadius = "15dp"
Android: topRightRadius = "15dp"
/>
</Shape>
Introduce this shape in the layout.
Mainly set android: backgroud
[Html]
<LinearLayout
Android: layout_width = "800dp"
Android: layout_height = "200dp"
Android: orientation = "horizontal"
Android: background = "@ drawable/myshape"
Android: layout_gravity = "center"
>
Here is a brief introduction. For details, refer to the introduction above in the android sdk.
From the wanli_smile Column