Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BottomNavigationView icon tinting broken in 3.2.0 #429

Closed
m-rm opened this issue Feb 5, 2019 · 6 comments
Closed

BottomNavigationView icon tinting broken in 3.2.0 #429

m-rm opened this issue Feb 5, 2019 · 6 comments
Assignees
Labels

Comments

@m-rm
Copy link

m-rm commented Feb 5, 2019

About this issue

  • When updating com.mikepenz:iconics-core from 3.1.0 to 3.2.0 the icon color is not updated anymore for the selected item in a BottomNavigationView.

Before:
device-2019-02-05-170102

After:
device-2019-02-05-170240

res/layout/activity_main.xml (only relevant code)

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginStart="0dp"
    android:layout_marginEnd="0dp"
    android:background="?android:attr/windowBackground"
    app:itemIconTint="@color/main_menu_items"
    app:itemTextColor="@color/main_menu_items"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:menu="@menu/navigation" />

res/color/main_menu_items.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:color="@color/green" />
    <item android:color="@color/grey"  />
</selector>

MainActivity.kt (only relevant code)

// Create icons for navigation
val planningIcon = IconicsDrawable(this).icon(CommunityMaterial.Icon2.cmd_history)
val homeIcon = IconicsDrawable(this).icon(CommunityMaterial.Icon2.cmd_home)
val calendarIcon = IconicsDrawable(this).icon(CommunityMaterial.Icon.cmd_calendar)

// Set icons
val menu = navigation.menu
menu.findItem(R.id.menu_nav_planning).icon = planningIcon
menu.findItem(R.id.menu_nav_home).icon = homeIcon
menu.findItem(R.id.menu_nav_calendar).icon = calendarIcon

Details

  • Used library version: iconics-core 3.2.0, iconics-views 3.2.0
  • Used support library version: Appcompat 1.0.2
  • Used gradle build tools version: 3.3.0
  • Used tooling / Android Studio version: 3.3
@mikepenz
Copy link
Owner

mikepenz commented Feb 5, 2019

@mikepenz mikepenz self-assigned this Feb 5, 2019
@mikepenz
Copy link
Owner

mikepenz commented Feb 5, 2019

Do you set a tintList to the bottom navigation view, or just a single color?

@m-rm
Copy link
Author

m-rm commented Feb 5, 2019

I created a demo app that shows the issue. If you edit app/build.gradle and change the version to 3.1.0 it works fine.

MyApplication.zip

Edit: Sorry for not answering your question. I do not know what a tintList is, but my code is posted above. There is no additional styling in MainActivity.kt.

@zTrap
Copy link
Contributor

zTrap commented Feb 6, 2019

Fixed in #430

@zTrap
Copy link
Contributor

zTrap commented Feb 6, 2019

@m-rm also You can set all icons automatically via

Menu menu2 = ((BottomNavigationView) findViewById(R.id.navigation_auto)).getMenu();
IconicsMenuInflaterUtil.parseXmlAndSetIconicsDrawables(this, R.menu.menu_playground, menu2);

(code from PlaygroundActivity.java)

@m-rm
Copy link
Author

m-rm commented Feb 6, 2019

Thanks for the fix! I will try your suggestion when there is a new release.

@zTrap zTrap added the bug label Feb 6, 2019
@zTrap zTrap closed this as completed Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants