Tab with icon using TabLayout in Android Design Library

后端 未结 3 1960
北荒
北荒 2021-02-06 01:29

I\'m trying to use the new TabLayout in the android design library to create app bar with icons only.

like this: \"

3条回答
  •  无人共我
    2021-02-06 01:49

    i solved it like this:

    tint_tab.xml

    
    

    in you java code

    TintableImageView tab1 = (TintableImageView) LayoutInflater.from(this).inflate(R.layout.tint_tab, null);
    tab1.setImageResource(R.drawable.ic_dummy);
    mTabLayout.getTabAt(0).setCustomView(tab1)
    

    ref: https://github.com/sockeqwe/appkit/blob/master/image/src/main/java/com/hannesdorfmann/appkit/image/TintableImageView.java

提交回复
热议问题