2017-05-28 192 views
1

如何創建一個Android layerlist繪製,給了我這樣的事情的Android Layerlist用實心填充圈內透明填充外圓

enter image description here

我已成功地產生僅僅只用下面的外圓code.But似乎可以找到一種方法來添加實體內部。

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="oval"> 
    <stroke 
     android:width="2dp" 
     android:color="#1582AF"/> 
</shape> 
+1

可能幫助https://stackoverflow.com/questions/38672404/why - 內圈填充 - 外圈 – Pavan

回答

1

圖層列表看起來象下面這樣:

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

    <item> <!--Your outer blue border shape--> 
     <shape android:shape="oval"> 
      <solid android:color="@android:color/white" /> 

      <size 
       android:width="40dp" 
       android:height="40dp" /> 

      <stroke 
       android:width="2dp" 
       android:color="#1582AF" /> 
     </shape> 
    </item> 
    <!--Your inner blue Solid circle shape--> 
    <item android:bottom="10dp" 
     android:left="10dp" 
     android:right="10dp" 
     android:top="10dp"> 
     <shape android:shape="oval"> 
      <solid android:color="#1582AF" /> 
     </shape> 
    </item> 
</layer-list> 

輸出:

enter image description here

+0

尺寸不適用於形狀標籤並延伸形狀! –