private TabLayout tabLayout;
/**
* 设置每个TabLayout的View
*/
private void setupTabIcons() {
for (int i = 0; i < mTitleList.size(); i++) {
tabLayout.getTabAt(i).setCustomView(getTabView(i));
}
}
/**
* 提供TabLayout的View
* 根据index返回不同的View
* 主意:默认选中的View要返回选中状态的样式
*/
private View getTabView(int index) {
//自定义View布局
View view = LayoutInflater.from(getActivity()).inflate(R.layout.item_rank_tab, null);
TextView title = (TextView) view.findViewById(R.id.title);
ImageView iv = (ImageView) view.findViewById(R.id.iv);
title.setText(mTitleList.get(index));
if (index != 1) {
view.setAlpha(0.5f);
if (index == 0) {
iv.setImageResource(R.drawable.rank_01);
} else { </