我的问题很简单:
在我的每个TextView中,我目前都使用了属性
android:fontFamily="sans-serif-light"
为在后 HC 设备上提供华丽的外观。
不幸的是,这不能适用于每个小部件,对于我的 Spinners,我需要覆盖 Adapter。
@Override
public View getView(int position, View convertView, ViewGroup parent) {
//You can use the new tf here.
if(convertView == null || convertView.getTag() == null) {
// new view - populate
convertView = inflater.inflate(android.R.layout.simple_spinner_dropdown_item, parent, false);
convertView.setTag(new Object());
}
CheckedTextView spinner_text=(CheckedTextView) convertView.findViewById(android.R.id.text1);
//Typeface should be set here...
return spinner_text;
}
}
那么,有没有一种方法可以通过代码获得完全相同的结果呢?
PS:不,我不想把字体放在资源文件夹中,我只想使用系统自带的。