티스토리 뷰

Mobile/Android

[Android]XML로 도형 그리기

out of coding 2015. 9. 8. 16:01

안드로이드 XML로 도형그리기


1. 사각형

<?xml version="1.0" encoding="UTF-8"?>  

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

    <stroke

          android:width="3dp"

          android:color="#FFCD00" />

    <corners

         android:bottomRightRadius="2dp"

         android:bottomLeftRadius="2dp"  

         android:topLeftRadius="2dp"

         android:topRightRadius="2dp"/>  

   <padding

         android:left="2dp"

         android:top="2dp"

         android:right="2dp"

         android:bottom="2dp" />

</shape>


2. 선

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

<stroke

       android:width="7dp"

       android:color="#0000FF"

       android:dashWidth="2dp"

       android:dashGap="1dp" /> 

</shape>


3. 원

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

    <solid

          android:color="#FF0000"/> 

    <stroke

          android:width="6dp"

          android:color="#7700FF00"

          android:dashWidth="47p"

          android:dashGap="1dp" /> 

<gradient

        android:startColor="#FF8800"

          android:endColor="#70FF66FF"

          android:angle="290"/>

    <padding

          android:left="9dp"

          android:top="9dp"

          android:right="9dp"

          android:bottom="9dp" /> 

    <corners android:radius="7dp" /> 

</shape>

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함