package com.example.xiong; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { /** Called when the activity is first created. */ private TextView txt; private Button btn; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn=(Button)findViewById(R.id.button1); txt=(TextView)findViewById(R.id.textView1); btn.setOnClickListener(new click() ); } class click implements View.OnClickListener { public void onClick(View v) { int Black = 0xffcccccc; txt.setText(“难搞哦”); txt.setTextColor(Color.YELLOW); txt.setBackgroundColor(Black); } } }