I want to do nothing more than change the font Typeface and size of my spinner text.
I have made some initial attempts. Nothing is crashing, but my spinner is blank. (I also have yet to implement the custom Typeface, I am just trying to get the spinner to work first.
In code:
protected SpinnerSortAdapter sAdapter;
protected Spinner sort;
protected String[] strings;
sort = (Spinner) getActivity().findViewById(R.id.spinner2);
strings = getActivity().getResources().getStringArray(R.array.sorting_items);
SpinnerSortAdapter sAdapter = new SpinnerSortAdapter(getActivity(),
android.R.layout.simple_spinner_item, strings);
sAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sort.setAdapter(sAdapter);
sort.setOnItemSelectedListener(new MyOnItemSelectedListener());
Adapter:
public class SpinnerSortAdapter extends ArrayAdapter<String> {
public SpinnerSortAdapter(Context context, int textViewResourceId,
String[] strings) {
super(context, textViewResourceId, strings);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
if (view instanceof TextView) {
((TextView) view).setTextSize(5);
}
return view;
}
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View row = super.getView(position, convertView, parent);
return (row);
}
}enter code here