我有一个选项卡布局,我在其中设置文本和矢量图像,如下所示:
TextView tab2 = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
tab2.setText("OFFER");
tab2.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_offer, 0, 0);
tabLayout.addTab(tabLayout.newTab().setCustomView(tab2));
如何更改可绘制矢量图像的色调?
最佳答案
像这样尝试:
Drawable drawables[] = textView.getCompoundDrawables();
drawables[0].setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
关于android - 如何为 setCompoundDrawablesWithIntrinsicBounds 设置色调颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43087035/