import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Typeface tf = Typeface.createFromAsset(getAssets(),"Tikkana.ttf");
TextView tv = (TextView) findViewById(R.id.CustomFontText);
tv.setText("ప్రముఖులు అభిప్రాయాలు");
tv.setTypeface(tf);
}
}
问问题
559 次
1 回答
0
请试一试。
public class CustomTextView extends TextView
{
public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public CustomTextView(Context context) {
super(context);
init();
}
private void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),
"Helvetica.ttf");
setTypeface(tf);
}
}
于 2013-04-20T12:24:15.110 回答