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

时间:2013-11-07 07:26:20

标签: android web-services android-fonts

在我的应用程序中,我使用了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);

1 个答案:

答案 0 :(得分:0)

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