我有自定义字体示例和一个小型列表视图示例应用程序。但我无法加入他们!
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = (TextView)findViewById(R.id.tv);
Typeface cFont = Typeface.createFromAsset(getAssets(), "fonts/jcc.ttf");
tv.setTypeface(cFont);
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textSize="18sp"
android:id="@+id/tv"
/>
和
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product_list);
String asim02 = System.getProperty("line.separator");
String products[] = {
"Apple" + asim02 +"Definition1",
"Orange" + asim02 +"Definition2",
"Banana"+ asim02 +"Definition3",
"Onion"+ asim02 +"Definition4", };
lv = (ListView) findViewById(R.id.list_view);
// Adding items to listview
adapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.p_list, products);
lv.setAdapter(adapter);
<TextView
android:textColor="?android:textColorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:id="@+id/p_list"
/>
请帮我自定义适配器以使用自定义字体
ProductList 应用程序的图像https://dl.dropbox.com/u/15065300/ProductList.png