我創建一個使用佈局編輯器上的main.xml稱爲textView1的TextView。我想用一個自定義字體,所以我的代碼字體集行成的onCreate,但它似乎並沒有recongnize名稱textView1的Android的TextView的onCreate改變
package com.mystraldesign.memorable;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
public class MemorableActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Typeface type = Typeface.createFromAsset(getAssets(),"fonts/optima.ttf");
textView1.setTypeface(type);
}
}
我敢肯定,我失去了一些東西簡單,但是這是我的第一次編碼Android仍然感覺我的方式。
下面的解決方案是否解決了您的問題? – 2012-04-28 05:37:49