2017-03-11 2 views
1

Je veux créer un arrière-plan personnalisé et je veux créer ceci dans le dossier drawable.
Pour ce contexte que j'écris ci-dessous les codes:Comment définir la couleur dégradée pour la forme dans Android

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 

    <stroke 
     android:width="1dp" 
     android:color="@color/gradient_center" /> 

    <corners android:radius="5dp" /> 

</shape> 

mais dans ce code, je viens régler vendu couleur pour stroke, je veux mettre en gradient couleur pour stroke couleur.

comment puis-je it?

Répondre

0
<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 

<gradient 
    android:angle="90" 
    android:endColor="#b5b6d2" 
    android:startColor="#555994" 
    android:type="linear" /> 

<corners android:radius="5dp" /> 

</shape>