按下按钮时有没有办法切换TextView
背景?
背景在drawable文件夹中,我需要这样的东西:
public void ChangeBG(){
Button mybutton = (Button) findViewById(R.id.button1);
mybutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//SET R.DRAWABLE.BG2 AS BACKGROUND
}
});
}
答案 0 :(得分:2)
我认为它很简单
textView.setBackgroundResource(R.drawable.your_image);