App노자
[Android] Button pressed effect 구현 방법 본문
1. 개요
일반적인 버튼으로 개발을 하면 유저가 버튼을 클릭했을때 별 다른 버튼을 만들다 보면 디자인적으로 버튼 클릭 시 효과를 만들어야 할 때가 있습니다.
기본적으로 버튼을 생성을 하면 클릭효과가 들어가 있습니다.
이것을 ripple effect 리플효과라고 말합니다.
2. XML
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_radius_button_blue" android:state_pressed="false" android:state_selected="false" />
<item android:drawable="@drawable/shape_radius_button_blue_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/shape_radius_button_blue_pressed" android:state_pressed="false" android:state_selected="true" />
</selector>
'Android > AndroidStudio' 카테고리의 다른 글
[Android] Dialog란 (0) | 2023.04.13 |
---|---|
[Kotlin] ViewPager2란 (0) | 2023.04.03 |
[Android] GridLayoutManager RecyclerView 구현 방법 (0) | 2023.03.30 |
[Android] RecyclerView란 (0) | 2023.03.25 |
[Android] ListView란 (0) | 2023.03.18 |