Android supports color gradient.CodeImplementation, so I will briefly introduce the implementation method, which is one of my projects. The color value above is # e8e8e8, and the color value below is # dbdbdb, if you want to achieve a gradient and there is an obvious line at the end of the gradient, you need the color at the gradient end to be a little deeper than dbdbdb,
Create a test_gradient.xml file in drawable as follows:
<? XML version = "1.0" encoding = "UTF-8"?> <Shape xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Shape = "rectangle"> <gradient Android: angle = "270" Android: endcolor = "# b9b9b9" Android: startcolor = "# e8e8e8"/> </shape>
The usage is as follows:
<Imageview Android: layout_width = "fill_parent" Android: layout_height = "10dip" Android: Background = "@ drawable/test_gradient"/>
OK, my endcolor is a little deeper than the following color dbdbdb, so there will be an obvious line at the end of the gradient. If you don't want this line, set endcolor to dbdbdb, OK ~. In gradient, angle refers to the angle of gradient color, which is changed to 90,180,270. Let's try the effect on your own. I won't be able.