I created a custom Tint Aware AutoCompleteTextView to solve this problem.
package com.atrinax.gist; import android.content.Context; import android.support.v7.internal.widget.TintTypedArray; import android.util.AttributeSet; import android.widget.AutoCompleteTextView; public class TintAutoComplete extends AutoCompleteTextView { private static final int[] TINT_ATTRS = { android.R.attr.background }; public TintAutoComplete(Context context) { this(context, null); } public TintAutoComplete(Context context, AttributeSet attrs) { this(context, attrs, android.R.attr.editTextStyle); } public TintAutoComplete(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, TINT_ATTRS, defStyleAttr, 0); setBackgroundDrawable(a.getDrawable(0)); a.recycle(); } }
Add this class to your project. Use in xml like this:
<com.atrinax.gist.TintAutoComplete android:layout_width="fill_parent" android:layout_height="fill_parent" />
The disadvantage of this solution is that it relies on an inner class
android.support.v7.internal.widget.TintTypedArray
which may change or become unavailable in the future. Please take a look at Derek's answer below - this is a solution to the background problem that arises from my answer.
source share