【发布时间】:2016-06-04 21:45:14
【问题描述】:
我将tablayout设置如下,
private void setupTabIcons() {
TextView tabOne = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
tabOne.setText("Status");
tabOne.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.status, 0, 0);
tabLayout.getTabAt(0).setCustomView(tabOne);
TextView tabTwo = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
tabTwo.setText("Rating");
tabTwo.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.rateit, 0, 0);
tabLayout.getTabAt(1).setCustomView(tabTwo);
}
如何更改所选标签的图标?我正在使用 tablayout。
【问题讨论】: