2013-10-18 2 views
0

원과 선으로 구성된 모양을 갖고 싶습니다. 아마도 여기서 일하는 방식을 이해하지 못했을 것입니다.안드로이드 복잡한 모양 그림 이해

먼저 선 모양을 회전하여 세로선을 만드는 방법을 생각했습니다. horizontal line : 예상대로

<rotate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:fromDegrees="0" 
    android:toDegrees="90" 
    > 
    <shape android:shape="line"> 
     <stroke 
      android:width="2dp" 
      android:dashWidth="2dp" 
      android:dashGap="4dp" 
      android:color="@android:color/holo_blue_bright" 
      /> 
    </shape> 
</rotate> 

이것은 나에게 수평의 선을 작성, 수직 라인을 만들지 않습니다. fromDegrees 속성을 90으로 변경할 때마다 세로 형 속성이 있습니다. toDegrees은 무시됩니다.

<rotate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:fromDegrees="90" 
    android:toDegrees="190" 
    > 
    <shape android:shape="line"> 
     <stroke 
      android:width="2dp" 
      android:dashWidth="2dp" 
      android:dashGap="4dp" 
      android:color="@android:color/holo_blue_bright" 
      /> 
    </shape> 
</rotate> 

결과는 vertical line입니다.

좋아, 그래서, 나는 이해하지 못한다. , circle 은 원 모양의 전체 크기를 채우고 있다고 생각하는 데, 전체 라인을 통해 그려지 : vertical line with circle

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item> 
     <rotate android:fromDegrees="90"> 
      <shape android:shape="line"> 
       <stroke 
        android:width="2dp" 
        android:dashWidth="2dp" 
        android:dashGap="4dp" 
        android:color="@android:color/holo_blue_bright" /> 
      </shape> 
     </rotate> 
    </item> 
    <item> 
     <shape android:shape="oval"> 
      <stroke android:color="#000" android:width="2dp" /> 
      <solid android:color="@android:color/white" /> 
     </shape> 
    </item> 
</layer-list> 

내가 얻을 것은 단지 원이다 : 나는 이런 식으로 뭔가를 얻을 수 있도록의이 원을 추가하자 scale 요소를 추가하여 원의 크기를 50 % 축소했습니다.

<scale 
    android:scaleWidth="50%" 
    android:scaleHeight="50%"> 
    <shape android:shape="oval"> 
     <stroke android:color="#000" android:width="2dp" /> 
    </shape> 
</scale> 

그 후, 원이 사라지고 나만 다시 선이 나타납니다. 아무도 내가 이해할 수있게 도와 줄 수 있습니까?

답변