据我所知,我们可以在xml中编写后在xml中定义onClick标记,我们可以通过xml中指定的名称轻松地在
java代码中使用,例如
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:onClick="myClick" />
public void myClick(View v) {
// does something very
}
1)有没有办法在XML中定义onTouch,如果是,那么如何使用???
2)或者在onClick监听器中实现onTouch Listener的任何其他方式;
在这里,我的目标是交互100多个按钮而不定义按钮名称如下所述:并且还具有onTouch功能……
Button mbutton;
mbutton = (Button)findViewbyId(R.id.button);
谢谢