安卓按键设置TextView字体的大小
Activity里面的函数为
button1 = (Button)layout.findViewById(R.id.button1);
button2 = (Button)layout.findViewById(R.id.button2);
text = (TextView)layout.findViewById(R.id.textView2);
text1 = (TextView)layout.findViewById(R.id.textView3);
text.setText(String.valueOf(size));
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) \{
// TODO 自动生成的方法存根
size++;
text.setText(String.valueOf(size));
text1.setTextSize(size);
\}
});
button2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) \{
// TODO 自动生成的方法存根
size--;
text.setText(String.valueOf(size));
text1.setTextSize(size);
\}
\});
还没有评论,来说两句吧...