在我的应用程序中,我使用了JSON Web服务。通过Web服务,我得到了Telugu字体。如何将这个泰卢固语字体添加到我的微调器?
LayoutInflater lv = getLayoutInfalter();
View v = lv.inflate(R.layout.spineerfont,false);
TextView tv = (TextView)v.findViewById(R.id.sp);
Typeface faceGautami = Typeface.createFromAsset(getAssets(), "gautami.ttf");
tv.setTypeface(faceGautami);
答案 0 :(得分:0)
您可以在SpinnerAdapter
和getView()
中通过自己的自定义getDropDownView()
应用字体。
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(yourRowlayout, parent,false);
TextView make = (TextView) row.findViewById(R.id.sp);
Typeface myTypeFace = Typeface.createFromAsset(context.getAssets(),
"fonts/gautami.ttf");
v.setTypeface(myTypeFace);
v.setText(itemList.get(position));
return row;
}
public View getDropDownView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(yourRowlayout, parent,false);
TextView make = (TextView) row.findViewById(R.id.sp);
Typeface myTypeFace = Typeface.createFromAsset(context.getAssets(),
"fonts/gautami.ttf");
v.setTypeface(myTypeFace);
v.setText(itemList.get(position));
return row;
}