반응형
- drawable 폴더에 xml 생성 ( round_button )
- stroke : 테두리
- solid : 배경색
- corners : 모서리 모양
<selector xmlns:android="http://schemas.android.com/apk/res/android">
//클릭한 경우
<item android:state_pressed="true">
<shape>
<stroke android:width="2dp" android:color="@color/press_blue" />
<solid android:color="@color/press_blue"/>
<corners android:bottomLeftRadius="12dp"
android:bottomRightRadius="12dp"
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>
</item>
//클릭 안한 경우
<item android:state_focused="true">
<shape>
<stroke android:width="2dp" android:color="@color/unpress_blue" />
<solid android:color="@color/unpress_blue"/>
<corners android:bottomLeftRadius="12dp"
android:bottomRightRadius="12dp"
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>
</item>
<item>
<shape>
<stroke android:width="2dp" android:color="@color/unpress_blue" />
<solid android:color="@color/unpress_blue"/>
<corners android:bottomLeftRadius="12dp"
android:bottomRightRadius="12dp"
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>
</item>
</selector>
반응형
*** 적용 ***
<androidx.appcompat.widget.AppCompatButton
...
android:background="@drawable/blue_corner_round_button" />
반응형
'Mobile > Android' 카테고리의 다른 글
[ Android ] 버튼 이미지(변경 + hover 효과) (0) | 2023.07.23 |
---|---|
[ Android ] 커스텀 레이아웃 색 변경 (0) | 2023.07.23 |
[ Android ] 손쉽게 Custom Toast 만들기 (0) | 2023.07.22 |
[ Android ] Custom Progressbar 커스텀 프로그래스바 만들기 (0) | 2023.07.22 |
[ Android ] Activity 와 Intent 이해하기 (0) | 2023.07.21 |