public class Main extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
TextView study_id = (TextView)findViewById(R.id.study_id); study_id.setOnClickListener( new OnClickListener(){ @Override public void onClick(View arg0) { Toast toast = Toast.makeText(getApplicationContext(), "I am Clicked", Toast.LENGTH_LONG);//提示被点击了 toast.show(); } }); } }