Android UI design tips-making a gradient background, androidui
Gradient Production
A few days ago, I suddenly found that QQ's default chat background is changing gradually. Then I learned how to make a background color gradient. Here I will summarize it.
1. Select the upper and lower colors respectively. Here we use black "#000000", gray "# aaaaaa", white "# ffffff".
2. Create a shape in drawable, define the gradient tag, and define three attributes: startstartColor, centerstartColor, and endstartColor. The angle attribute defines the rotation angle. The type attribute defines the Gradient type of the color.
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="90" android:centerColor="#aaaaaa" android:endColor="#000000" android:startColor="#ffffff" android:type="linear"></gradient></shape>
3. Call it in background.
Type attribute
- Linear property value: solution as shown in. The color on the gradient is linear distribution.
- Radial property value: A gradient from the inside to the outside. When using this property value, you must set the gradientRadius property.
- Sweep property value: this is a bit unclear, it is a bit like a slice gradient, the specific picture will be clearer
Copyright Disclaimer: This article is an original article by the blogger. You are welcome to repost it. For repost, please describe the source of the article in a conspicuous position and provide a connection.