Android desing support lib change the Tab indicator -
current there no method set drawable in tabindicator of tablayout design support lib. is there other way set drwable tabindicator?
you have set title values yourself
see code snippet:
public void setuptablayout(tablayout tablayout) { tablayout.settabmode(tablayout.mode_scrollable); tablayout.settabgravity(tablayout.gravity_center); tablayout.setupwithviewpager(mviewpager); textview tab = (textview) layoutinflater.from(this).inflate(r.layout.custom_tab, null); tab.settext("library"); tab.setcompounddrawableswithintrinsicbounds(0, r.drawable.ic_tabbar_library, 0, 0); tablayout.gettabat(0).setcustomview(tab); //.. }
custom_tab.xml
<?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tab" />
maybe help.
Comments
Post a Comment