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);
}
});
本文介绍如何在Activity中通过按钮点击事件调整文本大小并更新显示。

1117

被折叠的 条评论
为什么被折叠?



