Tab with icon using TabLayout in Android Design Library -
i'm trying use new tablayout in android design library create app bar icons only.
like this:
how can using new tablayout android design library.
is there simple solution this, or have use setcustomview only. i'm trying avoid using it. because didn't tint color icon image above.
i try write this:
tablayout.addtab(tablayout.newtab().seticon(r.drawable.ic_dashboard))
but icon still stay in same color when select tab
you have create selector
icon. example:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/ic_dashboard_pressed" android:state_pressed="true" /> <item android:drawable="@drawable/ic_dashboard_selected" android:state_selected="true" /> <item android:drawable="@drawable/ic_dashboard_normal" /> </selector>
Comments
Post a Comment