I have a basic AutoCompleteTextView and an ArrayAdapter bound to it. Works great on Android 4.*, but on 2.3 whenever I scroll the dropdown the rows render in all black. If I tap on a row then the entire dropdown renders correctly.
In the below text, when the TextView is generated using inflate, if I set the background color to white (the commented out line) then it always shows white even when scrolling, but the tap selection effect (changing the row to the system tap a row color) doesn’t work then.
I am using actionbarsherlock here but I would hope that wouldn’t the the cause here. Any ideas?
Screenshot: https://i.stack.imgur.com/GfJ32.png
public class AutocompleteAdapter extends ArrayAdapter<String> implements Filterable {
public AutocompleteAdapter(Context context) {
super(context, android.R.layout.simple_dropdown_item_1line);
mInflater = LayoutInflater.from(context);
mContext = context;
}
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
final TextView tv;
if (convertView != null) {
tv = (TextView) convertView;
} else {
tv = (TextView) mInflater.inflate(android.R.layout.simple_dropdown_item_1line, parent, false);
//tv.setBackgroundColor(tv.getResources().getColor(R.color.white));
}
tv.setText(getItem(position));
return tv;
}
....
Its because your theme is dark..
If your theme in Manifest.xml is light.. ie,
I’ve get it to work by adding 2 xml files in values folder..
styles.xml
theme.xml
I couldnt find another way…