Shape Drawable(Rectangle)

Posted by ITPangPang
2016. 5. 15. 15:07 Android/.xml


Shape Drawable

(Rectangle)


(1) stroke

(2) solid

(3) size

(4) gradient

(5) corners

(6) padding




(1) stroke

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#FFFF00"
/>
</shape>


<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#FFFF00"
/>
</shape>


<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="#FF0F0F"
android:dashWidth="10dp"
android:dashGap="10dp"
/>
</shape>


(2) solid

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="#501234"
android:dashWidth="2dp"
android:dashGap="2dp"
/>
<solid
android:color="#589378"
/>
</shape>


(3) size

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="#501234"
android:dashWidth="2dp"
android:dashGap="2dp"
/>
<solid
android:color="#589378"
/>
<size
android:width="500dp"
android:height="150dp"
/>
</shape>


(4) gradient

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="#501234"
android:dashWidth="2dp"
android:dashGap="2dp"
/>
<solid
android:color="#589378"
/>
<size
android:width="500dp"
android:height="150dp"
/>
<gradient
android:startColor="#FFF000"
android:centerColor="#123456"
android:endColor="#654321"
/>
</shape>


<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="#501234"
android:dashWidth="2dp"
android:dashGap="2dp"
/>
<solid
android:color="#589378"
/>
<size
android:width="500dp"
android:height="150dp"
/>
<gradient
android:startColor="#FFF000"
android:centerColor="#123456"
android:endColor="#654321"
android:angle="180"
/>
</shape>


<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="#501234"
android:dashWidth="2dp"
android:dashGap="2dp"
/>
<solid
android:color="#589378"
/>
<size
android:width="500dp"
android:height="150dp"
/>
<gradient
android:startColor="#FFF000"
android:centerColor="#123456"
android:endColor="#654321"
android:angle="180"
android:type="sweep"
/>
</shape>


(5) corners

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="#501234"
android:dashWidth="2dp"
android:dashGap="2dp"
/>
<solid
android:color="#589378"
/>
<size
android:width="500dp"
android:height="150dp"
/>
<gradient
android:startColor="#FFF000"
android:centerColor="#123456"
android:endColor="#654321"
android:angle="180"
android:type="sweep"
/>
<corners
android:radius="50dp"
android:bottomLeftRadius="10dp"
android:topRightRadius="10dp"
/>
</shape>



AND

(5) padding

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="10dp"
android:color="#501234"
android:dashWidth="2dp"
android:dashGap="2dp"
/>
<solid
android:color="#589378"
/>
<size
android:width="300dp"
android:height="150dp"
/>
<gradient
android:startColor="#FFF000"
android:centerColor="#123456"
android:endColor="#654321"
android:angle="180"
android:type="sweep"
/>
<corners
android:radius="50dp"
android:bottomLeftRadius="10dp"
android:topRightRadius="10dp"
/>
<padding
android:top="10dp"
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
/>
</shape>



+

http://itpangpang.xyz/173




'Android > .xml' 카테고리의 다른 글

Layout Weight(Vertical)  (0) 2016.05.15
Layout Weight(Horizontal)  (0) 2016.05.15
Shape Drawable(Oval)  (0) 2016.05.15
Shape Drawable(Line)  (0) 2016.05.15