Round Button 생성하기

By | 2021년 10월 29일
Table of Contents

Round Button 생성하기

참조

아래의 코드를 이용해 모서리가 둥근 버튼을 생성할 수 있다.

drawable

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF" />
    <corners android:radius="6dp" />
    <stroke
        android:width="1dp"
        android:color="#0000FF" />
</shape>

layout

android.widget.Button 으로 설정해야 android:background 이 인식된다.

        <android.widget.Button
            android:id="@+id/add_folder"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:layout_marginEnd="20dp"
            android:layout_marginTop="0dp"
            android:padding="5dp"
            android:textSize="20sp"
            android:textColor="#0000FF"
            android:background="@drawable/button_round"
            style="?android:attr/borderlessButtonStyle"
            android:text="@string/add_folder" />

답글 남기기