2015-08-25 14 views

回答

0

你將不得不設置標題重視自己

看到這樣的代碼片段:

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" /> 

也許這幫助。

+0

這種方式是不可能的。我需要將我的drawable設置爲指標而不是製表符視圖。 – MayurDev