最佳答案
我的问题很简单:
在我的每个文本视图中,我当前都在使用属性
android:fontFamily="sans-serif-light"
为后 HC 设备提供华丽的外观。
不幸的是,这并不适用于每个小部件,对于我的 Spinners,我需要覆盖适配器。
@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: 不,我不想在资产文件夹中放置字体,我只想使用系统一。