में एपीआई स्तर 23 प्रोग्रामेटिक रूप से एपीआई स्तर 23 के नीचे एक बटन के ड्रॉबल टिंट को कैसे बदलें, मैं प्रोग्रामेटिक रूप से ड्रॉइंग लेफ्ट/ड्रायबल राइट के रंग को बदलने का तरीका जानने का प्रयास कर रहा हूं। नीचे के रूप में काम करता है जो उल्लेख किया है मैं अपने एक्सएमएल में drawable रंग का इस्तेमाल किया है> एपीआई स्तर 23 लेकिन रंग < एपीआई स्तर बदलने के लिए 23एंड्रॉइड
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="VIEW ALL"
android:layout_centerInParent="true"
android:background="#00000000"
android:drawableLeft="@mipmap/ic_menu_black_36dp"
android:layout_centerVertical="true"
android:id="@+id/view_all"
android:textColor="@color/bottom_color"
android:drawableTint="@color/bottom_color"
/>
Button prev = (Button) findViewById(R.id.prev);
Drawable[] drawables =prev.getCompoundDrawables();
drawables[0].setColorFilter(Color.GRAY, PorterDuff.Mode.MULTIPLY);
prev.setCompoundDrawables(drawables[0],null,null,null);
समाधान में सक्षम नहीं:
Drawable[] drawablesprev =prev.getCompoundDrawables();
//for drawableleft drawable array index 0
drawablesprev[0].setColorFilter(getResources().getColor(R.color.assessment_bottom), PorterDuff.Mode.SRC_ATOP);
//for drawableright drawable array index 2
drawablesprev[2].setColorFilter(getResources().getColor(R.color.assessment_bottom), PorterDuff.Mode.SRC_ATOP);
//for drawabletop drawable array index 1
drawablesprev[1].setColorFilter(getResources().getColor(R.color.assessment_bottom), PorterDuff.Mode.SRC_ATOP);
'android.support.v4.graphics.drawable.DrawableCompat' और इसके 'सेटटिंट (ड्रायबल ड्रॉबल, इंट टिंट)' विधि – pskink
का उपयोग करें, क्या आप इसके लिए नमूना कोड दे सकते हैं। मैं यहाँ kinnda अटक गया –
क्या अटक गया? आपका कोड क्या है? – pskink