2017-03-29 5 views
0

は、私は私がこのようなテキストとベクトル画像を設定していた中でタブレイアウトを持っている:setCompoundDrawablesWithIntrinsicBoundsの色合いを設定する方法は?

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

このようにしてみてください。

Drawable drawables[] = textView.getCompoundDrawables(); 
drawables[0].setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)); 
関連する問題