package com.example.fontsetting2;
import android.app.*;
import android.graphics.*;
import android.os.*;
import android.widget.*;
import android.view.Menu;
public class MainActivity extends Activity {
TextView[] tv = new TextView[3];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
setContentView(ll);
for(int i=0; i<tv.length; i++)
{
tv[i] = new TextView(this);
tv[i].setText("中文和and English.");
}
tv[0].setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
tv[1].setTypeface(Typeface.create(Typeface.SERIF, Typeface.ITALIC));
tv[2].setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD));
tv[0].setTextSize(16);
tv[1].setTextSize(16);
tv[2].setTextSize(16);
for(int i=0; i<tv.length; i++)
{
ll.addView(tv[i]);
}
}
@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;
}
}