본문 바로가기
Programming/Kotlin (Android)

[Android] 레이아웃 boder, radius 적용

by Skogkatt의 개인 블로그 2020. 5. 27.
반응형

[Android] 레이아웃 boder, background, radius 적용

  • drawable에 xml 생성

boder

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

<!-- drawable/border-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#FF0000" />
        </shape>
    </item>
    <item
        android:bottom="1dp"
        android:top="1dp"
        android:left="1dp"
        android:right="1dp"
        >
        <shape android:shape="rectangle">
            <solid android:color="#ffffff" />
        </shape>
    </item>
</layer-list>

 

radius

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

<!--drawable/radius-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="10dp"
    android:shape="rectangle" >
    <solid android:color="#FFF" />
    <!--radius-->
    <corners
        android:bottomLeftRadius="20dp"
        android:bottomRightRadius="20dp"
        android:topLeftRadius="20dp"
        android:topRightRadius="20dp" />
    <!--border-->
    <stroke
        android:width="2dp"
        android:color="#FF0000" />
</shape>

 

적용

  • View XML에 추가
<!-- android:background="@drawable/파일이름" -->
android:background="@drawable/background"

 

반응형

댓글