After that, you need to update your Adapter to be able to work with AppCompat. You do that by making it implement the new ThemedSpinnerAdapter interface.
public class MyAdapter extends BaseAdapter implements ThemedSpinnerAdapter {
Theme getDropDownViewTheme() { ... }
void setDropDownViewTheme(Theme theme) { ... }
}
These methods are used by Spinner to be able to tell the Adapter which theme to use for inflating any drop down views. To make this as easy as possible we have given you a Helper class which you can plug in to your adapter.
This means that your adapter becomes something like:
public class MyAdapter extends BaseAdapter implements ThemedSpinnerAdapter {
private final ThemedSpinnerAdapter.Helper mDropDownHelper;
public MyAdapter(Context context) {
mDropDownHelper = new ThemedSpinnerAdapter.Helper(context);
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View view;
if (convertView == null) {
// Inflate the drop down using the helper's LayoutInflater
LayoutInflater inflater = mDropDownHelper.getDropDownViewInflater();
view = inflater.inflate(R.layout.my_dropdown, parent, false);
}
// ...
return view;
}
@Override
public void setDropDownViewTheme(Theme theme) {
mDropDownHelper.setDropDownViewTheme(theme);
}
@Override
public Theme getDropDownViewTheme() {
return mDropDownHelper.getDropDownViewTheme();
}
}
Just for reference if you use the CursorAdapter your implementation can be much easier, just override newView(), no need to override getDropDownView() there: