修改 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)

想改成別的樣子,同理修改即可









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