android tv字体,best登陆「永久地址0365.tv」android默认字体android使用代码使用新的字体的常用代码...
頁面類
類名稱:MainActivity
package com.example.android_fonts_test;
import android.support.v7.app.ActionBarActivity;import android.content.Context;import android.graphics.Typeface;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
private Context mContext;??private TextView test_font_1;?private TextView test_font_2;?private TextView test_font_3;???? @Override??? protected void onCreate(Bundle savedInstanceState) {??????? super.onCreate(savedInstanceState);??????? setContentView(R.layout.activity_main);??????? ??????? mContext = this;??????? ??????? // 字體??????? Typeface typeface_1 = Typeface.createFromAsset(mContext.getAssets(),"fonts/Beyond Wonderland.ttf");??????? ??????? test_font_1 = (TextView)findViewById(R.id.test_font_1);??????? test_font_1.setTypeface(typeface_1);??????? ??????? ??????? Typeface typeface_2 = Typeface.createFromAsset(mContext.getAssets(),"fonts/Channel.ttf");??????? test_font_2 = (TextView)findViewById(R.id.test_font_2);??????? test_font_2.setTypeface(typeface_2);??????? ??????? Typeface typeface_3 = Typeface.createFromAsset(mContext.getAssets(),"fonts/JFHolNte.ttf");??????? test_font_3 = (TextView)findViewById(R.id.test_font_3);??????? test_font_3.setTypeface(typeface_3);??????? ??? }
@Override??? public boolean onCreateOptionsMenu(Menu menu) {??????? // Inflate the menu; this adds items to the action bar if it is present.??????? getMenuInflater().inflate(R.menu.main, menu);??????? return true;??? }
@Override??? public boolean onOptionsItemSelected(MenuItem item) {??????? // Handle action bar item clicks here. The action bar will??????? // automatically handle clicks on the Home/Up button, so long??????? // as you specify a parent activity in AndroidManifest.xml.??????? int id = item.getItemId();??????? if (id == R.id.action_settings) {??????????? return true;??????? }??????? return super.onOptionsItemSelected(item);??? }}
總結(jié)
以上是生活随笔為你收集整理的android tv字体,best登陆「永久地址0365.tv」android默认字体android使用代码使用新的字体的常用代码...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用uni-app报错this.setD
- 下一篇: el-input输入金额,保留两位小数