最近查看了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)
想改成别的样子,同理修改即可