package com.example.fontsetting;

import android.app.*;
import android.graphics.*;
import android.os.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import android.view.Menu;

public class MainActivity extends Activity {
TextView tv;
TextView tv2;
Button btn;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
setContentView(ll);

tv = new TextView(this);
tv.setText("覺得小弟弟不夠強壯嗎??給你仙丹服用!!");
tv2 = new TextView(this);
tv2.setText("小弟弟");
btn = new Button(this);
btn.setText("服用仙丹");

ll.addView(tv);
ll.addView(tv2);
ll.addView(btn);

btn.setOnClickListener(new SampleClickListener());

}

class SampleClickListener implements OnClickListener
{
public void onClick(View v)
{
tv2.setTextSize(200);
tv2.setTextColor(Color.RED);
}
}

@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;
}

}

arrow
arrow
    文章標籤
    android font color font size
    全站熱搜

    痞客興 發表在 痞客邦 留言(0) 人氣()