我在main.xml上使用 Layout Editor創(chuàng)建了一個(gè)textview名稱是textView1。我想使用一個(gè)自定義的字體,所以我在onCreate方法中創(chuàng)建了下面的代碼,但是好像不能識(shí)別textView1。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);
}
}什么原因呢?
添加回答
舉報(bào)
0/150
提交
取消