버튼 네비게이션 뷰에 배경색으로 보라색이 뜨는 문제 발생
아래와 같이 BottomNavigationView에 별도의 테마를 적용해 봅시다. colorPrimary 항목을 원하는 색상으로 변경합니다.
themes.xml
파일에 아래 코드를 추가합니다. @color/my_color
는 원하는 색상으로 대체해주세요.<style name="BottomNavigationTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">@color/my_color</item>
</style>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu"
app:itemIconTint="@color/bottom_nav_colors"
app:itemTextColor="@color/bottom_nav_colors"
android:background="@color/white"
app:itemBackground="@color/white"
android:theme="@style/BottomNavigationTheme" // 테마 적용
app:itemRippleColor="@android:color/transparent"
/>
이렇게 하면 선택한 아이템의 배경색만 변경할 수 있습니다.