안드로이드앱/ListView_리스트뷰
Ripple effect가 안 먹을 때?
나계환ga4
2021. 3. 9. 17:28
가끔 fragment에 listview나 gridview를 넣었을 때
클릭 효과(ripple effect)가 안 먹을 때가 있었다.
그럴 때
single_row나
single_cell의 xml에 속성을 추가해주면 된다.
android:foreground="?android:attr/selectableItemBackground"
이러면 기본 ripple 효과가 먹음
If, 색깔을 커스터마이징 해주고싶다면
drawable에 ripple.xml을 생성한다음 추가해주면 된다.
<ripple android:color="#ffff0000">
<item android:id="@android:id/mask"
android:drawable="@android:color/white" />
</ripple>
앱 전체의 ripple 색을 지정할 수도 있음
styles.xml에서 전체 앱 theme에 속성추가
<item name="colorControlHighlight">#dfdfdf</item>