2017-01-26 175 views
2

我想在圓圈內繪製小圓點。如何在XML中的實心圓圈內繪製小圓圈/圓點?

enter image description here

這是與衝程,我的XML代碼。

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="oval"> 
    <stroke 
     android:width="4dp" 
     android:color="#444444" /> 
    <solid android:color="#FF0000" /> 
</shape> 

enter image description here

回答

1

使用層列表標籤

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
<!-- Large red circle --> 
<item> 
    <shape 
     android:shape="oval"> 
     <stroke 
      android:width="1dp" 
      android:color="#000000" /> 
     <solid android:color="#FF0000" /> 
     <size 
      android:width="40dp" 
      android:height="40dp"/> 
    </shape> 
</item> 

<!-- Small black circle --> 
<item android:right="3dp" 
    android:left="-3dp" 
    android:top="3dp" 
    android:bottom="-3dp"> 
    <shape android:shape="oval"> 
     <stroke android:color="@android:color/transparent" 
      android:width="35dp"/> 
     <solid android:color="#000"/> 
     <size 
      android:width="5dp" 
      android:height="5dp"/> 
    </shape> 
</item> 

修改您所選擇的利潤和規模

+0

我嘗試這一點,但我仍掌握相同的紅色圓圈黑色筆畫代碼,我在您的意見下面添加

+0

我更新了答案。一探究竟。我認爲這就是你想要的 –