我发现在android的事件处理中有两种代码编写方式。一种是调用setOnClickListener之类的方法,并在java中传递一个匿名类,另一种是在Activity中添加一个名为onClick的xml属性并编写相应的方法,如下图所示。
<Button
android:id="@+id/idButtonTest1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_test1"
android:onClick="myClickButton1"/>
我想知道哪一个在 oop 角度(或 mvc 角度)更好,哪一个在未来更容易改变?