我已经使用bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);在actionbar中设置了微调器
然后设置
dropdownValues = getResources().getStringArray(R.array.sortby_array);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.sortby_array, android.R.layout.simple_spinner_item);
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
bar.setListNavigationCallbacks(adapter, this);现在我想改变字体样式..所以任何人都可以帮助我,请
发布于 2013-12-28 13:14:21
我已经用SpinnerAdapter做到了这一点。参见代码示例:
public class SpinnerAdapter extends ArrayAdapter<String> {
public SpinnerAdapter(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) {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),
"fonts/hattori.ttf");
((TextView) view).setTextColor(Color.parseColor("#000000"));
((TextView) view).setTypeface(tf);
((TextView) view).setTextSize(16);
}
return view;
}
}编辑:这不是在ActionBar中,所以不确定它是否工作相同。
https://stackoverflow.com/questions/20811073
复制相似问题