安卓button,安卓开发,eclipse,怎么弄两个button点击
展开全部
Button button1 = (Button) findViewById(R.id.btn1);
Button button2 = (Button) findViewById(R.id.btn2);
TextView textView1 = (TextView) findViewById(R.id.textView1);
TextView textView2 = (TextView) findViewById(R.id.textView2);
button1.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
textView1.setText("");
}
});
button2.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
textView2.setText("");
}
});
Button button2 = (Button) findViewById(R.id.btn2);
TextView textView1 = (TextView) findViewById(R.id.textView1);
TextView textView2 = (TextView) findViewById(R.id.textView2);
button1.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
textView1.setText("");
}
});
button2.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
textView2.setText("");
}
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询