2013-07-23 49 views
0

這是我的xml文件,它在線性佈局周圍添加邊框如何在此代碼中添加漸變顏色效果代碼?我想更換gradiend顏色如何在佈局邊框xml文件中添加漸變效果

下面

這個顏色#C0C0C0是我的代碼

<?xml version="1.0" encoding="utf-8"?> 
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item> 
    <shape android:shape="rectangle"> 
    <solid android:color="#000000" /> 
    </shape> 
    </item> 
    <item 
     android:left="1dp" 
     android:right="1dp" 
     android:top="2dp" 
     android:bottom="2dp" > 
<shape android:shape="rectangle"> 
<solid android:color="#C0C0C0" /> 
</shape> 
</item>  
</layer-list> 

我想在我的邊框添加該代碼.xml文件如何合併?

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle"> 

<gradient 
    android:startColor="#fefdfe" 
    android:endColor="#e8e3ec" 
    android:angle="90" /> 

</shape> 

回答

0

與梯度形狀只需更換

<shape android:shape="rectangle"> 
    <solid android:color="#C0C0C0" /> 
</shape> 

0

試試這個: -

<shape android:shape="rectangle"> 
     <gradient 
       android:startColor="#5a5a5a88" 
       android:endColor="#14141488" 
       android:angle="270" android:centerX="0.25"/> 

    </shape> 
1

填充佈局梯度:

<?xml version="1.0" encoding="utf-8"?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
<item> 
    <shape android:shape="rectangle"> 
     <gradient 
      android:startColor="#4fc939" 
      android:centerColor="#0c87c5" 
      android:endColor="#b4ec51" 
      android:angle="180" /> 
    </shape> 
</item>