0
我正在研究Android應用程序的列表視圖。請告訴我如何使用我的字體作爲List中的TextView
?如何從ListView中獲取TextView來設置字體? Android
Typeface typeface;
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
String fontPath = "fonts/28.ttf";
typeface = Typeface.createFromAsset(getAssets(), fontPath);
ListView menuList = (ListView) findViewById(R.id.ListView_Menu);
String[] items = {
getResources().getString(R.string.menu_item_play),
getResources().getString(R.string.menu_item_settings),
getResources().getString(R.string.menu_item_help),
getResources().getString(R.string.menu_item_exit)
};
ArrayAdapter<String> adapt = new ArrayAdapter<String>(this, R.layout.menu_item, items);
menuList.setAdapter(adapt);
//View v1=(View)menuList.getItemAtPosition(0);
。 –