我使用教程在Android中生成Button,如下所示
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/self_destruct"
android:onClick="selfDestruct" />这里,方法selfDestruct正在按下按钮被调用。是否有任何方法可以创建方法体,在其中使用此XML,如下所示
public void selfDestruct(View view) {
// Comments about Method....
}发布于 2014-02-12 16:45:26
嗯,很难在正确的位置生成这个方法,,因为它可以在很多地方--(活动)--或者仅仅在abstract Activity中。
在Fragment的情况下,通过eclipse/ADT在正确的位置生成它可能会更加困难。
我认为这就是为什么这个方法不是由eclipse/ADT生成的。
好吧,你得用我自己的意见来写。
https://stackoverflow.com/questions/21733962
复制相似问题