我有一个标签布局,我在其中设置文本和矢量图像:
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));
如何更改可绘制矢量图像的色调?
答案 0 :(得分:2)
试试这样:
Drawable drawables[] = textView.getCompoundDrawables();
drawables[0].setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));