修改 TabPageIndicator 样式

最近查看了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)

想改成别的样子,同理修改即可









發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章