小编Rog*_*ger的帖子

更改所选标签的图标

我按如下方式设置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);
}
Run Code Online (Sandbox Code Playgroud)

如何更改所选标签的图标?即时通讯使用tablayout.

android android-tablayout

3
推荐指数
1
解决办法
4175
查看次数

标签 统计

android ×1

android-tablayout ×1