🖥 Programming/📱 Android (Java)
[Android] TabLayout에서 tabRippleColor 설정방법 (탭 클릭 색상)
MinChan-Youn
2021. 10. 7. 12:48
이번에는 TabLayout에서 탭 클릭하였을때 나타나는 색상을 변경하는 방법에 대해서 알아보겠습니다.
즉 TabLayout의 Tab을 클릭했을 때 나타나는 클릭 이벤트의 색상값을 말합니다.
결론부터 들어가자면!
사용하는 속성값은 tabRippleColor 을 사용합니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:tabRippleColor="#00F0F0">
</com.google.android.material.tabs.TabLayout>
</LinearLayout>
누구나 다 아는 것이지만... 혹시나 코드만 복사하는 분들을 위해서!
속성값은 android:****을 사용하는 것이 아닌 app:****을 사용하기 때문에
최상위에 xmlns:app="http://schemas.android.com/apk/res-auto"을 설정 해야합니다.
Tip.
Tab클릭 이벤트의 색상을 없애고자 하는 사람은 다음과 같이 속성값을 설정하면 됩니다.
app:tabRippleColor="@android:color/transparent">