2011-12-21 83 views
0

我想創建我的標籤,看起來像這樣。爲自定義標籤外觀創建漸變

enter image description here

但我最終得到這樣

enter image description here

我想創建在有源標籤的頂部上的簡單的梯度(在這種情況下搜索最接近地點)的效果用灰色顏色或接近白色的東西。

這裏是選擇

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle"> 
<gradient 
    android:startColor="#000" 
    android:centerColor="#FFF" 
    android:endColor="#000" 
    android:type="linear"/> 
</shape> 

我該如何去實現這種效果的代碼?我也想知道如何在兩側實現圓角。目前,當我選擇活動標籤時,圓角只適用於右側角落。這是我如何做的代碼。

截至目前我看起來像這樣。

enter image description here

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle"> 
<corners 
    android:bottomLeftRadius="7dp" 
    android:topRightRadius="7dp"/> 
<solid 
    android:color="#000" /> 
<stroke 
    android:width="2dp" 
    android:color="#fff"/> 

我想以這樣的方式,當我點擊左側選項卡左側角應該被激活,並且右標籤進行編碼,右下角必須被激活。

感謝您的時間:)

回答

0

<gradient />你需要使用android:angle="90"。對於角落,您可以創建一些形狀並在點擊時改變它們。