둥근 테두리가 엄청 많이 들어가는 프로젝트를 하고 있다. 그나마 이미지로 처리하는게 아니라서 다행이지만…
일단 둥근 테두리의 배경을 만들어본다.
<!-- bg_container_corner_16_solid_red.xml --> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="16dp" /> <solid android:color="#f00" /> </shape>
둥근 테두리를 적용하고 눌림효과를 주기위해 이렇게 설정하면
<LinearLayout android:background="@drawable/bg_container_corner_16_solid_red" android:foreground="?selectableItemBackground"> <TextView android:text="회원가입" /> </LinearLayout>

이렇게 나온다 -_-
이걸 해결하려면 CardView
로 감싸거나 ripple 효과
를 줘야하는데, 아무래도 좀 더 쉬운 ripple 효과를 주기로 한다.
<!-- bg_container_corner_16_solid_red_ripple.xml --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?colorControlHighlight"> <item android:drawable="@drawable/bg_container_corner_16_solid_red" /> </ripple>
<LinearLayout android:background="@drawable/bg_container_corner_16_solid_red_ripple"> <TextView android:text="회원가입" /> </LinearLayout>
이렇게 설정하면

이렇게 깔끔하게 눌림효과가 적용된다.
문제는 이걸 처음부터 했었어야했는데, 이제 적용하려니 엄두가 안난다 ㅠㅠ