안드로이드
[Android] floating button Icon 색상 적용 안되는 문제
Shino72
2023. 8. 25. 10:53
[문제 상황]
Floating Button에서 icon을 적용하고 흰색으로 색상을 바꾸려고 할 때 tint 자동완성을 하게 되면 아래와 같이 작성된다.
android:tint="@android:color/white"
하지만 실제로는 흰색이 적용되지 않는다.
https://github.com/material-components/material-components-android/issues/1106
[FloatingActionButton] FAB Icon is Always Black · Issue #1106 · material-components/material-components-android
Hello! For some reason when I set an icon using android:src on a FAB, it will force the icon to be black rather than whatever colour the (vector) icon actually is. The issue popped up once I upgrad...
github.com
stackoverflow에서 관련 문제를 찾아보니 다양한 해결 방법을 제시하였다.
[해결방법]
- @tint에 @null 값 적용
- app:tint="@android:color/white" 로 적용
본인은 1번 방법으로 시도해도 적용이 되지 않아. android:tint를 app:tint로 적용해주니 잘 되었다.