Android Button 单击事件
方法一:在XML文件中指定 单击事件函数 <Button android:id="@+id/button1" android:layout_width="120dip" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/textView1" android:layout_marginTop="59dp" android:onClick="onclicklistener" android:text="@string/mybuttonstr" /> 然后在代码中实现这个函数。注意,函数需要public 要不会异常。 public void onclicklistener(View tager) { TextView textView1 =(TextView)findViewById(R.id.textView1); textView1.setText("西安.王磊"); } 方法二: 在activity...