Android desing support lib change the Tab indicator -


**enter image description here**

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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -