最近查看了ViewPagerIndicatorr的代碼,下載地址 https://github.com/JakeWharton/Android-ViewPagerIndicator
其中有個Tab帶圖片的類SampleTabsWithIcons.java
原始界面效果是
但是我想着 讓圖片在 文字的下面
library包中 TabPageIndicator.java
修改addTab(int index, CharSequence text, int iconResId)方法
tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
改爲
tabView.setCompoundDrawablesWithIntrinsicBounds(0, iconResId, 0, 0);
就可以了
修改後界面
setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom)
想改成別的樣子,同理修改即可