我有列表视图。它包含 3 个不是来自 activity_main.xml 的 TextView。
cursor = myDatabase.getJoinedInfo(etSearch.getText().toString().trim());
String[] columns = new String[] { "re_value", "g_value", "ke_value" };
int[] to = new int[] { R.id.tvHiragana, R.id.tvMeaning, R.id.tvKanji };
dataAdapter = new SimpleCursorAdapter(this, R.layout.wordonlist,
cursor, columns, to, 0);
// Assign adapter to ListView
listView.setAdapter(dataAdapter);
如何更改 ListView 中 TextViews 的字体?
final Typeface mFont = Typeface.createFromAsset(getAssets(),
"fonts/himaji.otf");
LayoutInflater ltInflater = getLayoutInflater();
View view = ltInflater.inflate(R.layout.wordonlist, null, false);
tvHiragana=(TextView) view.findViewById(R.id.tvHiragana);
tvHiragana.setTypeface(mFont);
此代码无法更改 TextView 的字体。我做错了什么?