Home >Java >javaTutorial >How to implement background image color gradient in android

How to implement background image color gradient in android

高洛峰
高洛峰Original
2017-01-20 15:53:442532browse

Commonly used, record it.
Rendering:

How to implement background image color gradient in android

First create a new xml file bg_gradient.xml

<?xml version="1.0" encoding="utf-8"?>  
<shape xmlns:android="http://schemas.android.com/apk/res/android" >  
  
    <gradient  
        android:startColor="#55FF0000"   
        android:centerColor="#99A73C3C"  
        android:endColor="#99000000"  
        android:angle="270"  
        />  
  
    <corners android:radius="0dip" />  
  
</shape>

Quote in the layout file

android:background="@drawable/bg_gradient"

More android For related articles on the method of realizing color gradient of background images, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn