如何将泰卢固语字体应用于微调器



在我的应用程序中,我使用了JSON Web服务。通过网络服务,我得到了泰卢固语字体。如何将此泰卢固语字体添加到我的微调器中?

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);

您可以通过自己的自定义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;
}

最新更新