본문 바로가기

소프트웨어/Android/Java/Ndk

Android] XML상에서 Layout 둥근모서리 적용하기

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

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

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

    <solid android:color="#31222222"/>

    

</shape>



 ./drawable 폴더에 자신이 원하는 shape xml을 생성한다. 만약 shape.xml이라고 파일을 저장했으면



사용하고자하는 layout xml에서 

<Button

                android:id="@+id/btnRefresh"

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:layout_margin="5dp"

                android:background="@drawable/shape_round_mid_refreshbtn"

/>

위와같이 

android:background="@drawable/shape_round_mid_refreshbtn"

를 이용해서 shape를 정의해주면