AndroidAnnotation events
目录(?)[+]
ClickEvents
@Click
Since AndroidAnnotations 1.0
The
@Click
annotation indicates that an activity
method must be called when the corresponding
view is
clicked.
@Click
注解表示当相对应的视图被单击时,一个activity的方法必须被调用。
The view id can be set in the annotation parameter, ie
@Click(R.id.myButton)
.
可以在注解参数中设置
视图id,像
@Click(R.id.myButton)
。
If the view id is
not set, the
name of the method will be used to guess the view id.
如果没有设置视图id,方法名将用于猜测这个视图id。
The method may have zero or one parameter, and this parameter can only be a View (the view that was clicked). The method must not be private. Two different methods cannot handle the same view.
这个方法可以无参或者有一个参数,这个参数只能是一个视图(被单击的那个)。这个方法必须不能是私有的。两个方法不能处理同一个视图。
Usage example:用例:
@Click(R.id.myButton) void myButtonWasClicked() { [...] } @Click void anotherButton() { [...] } @Click void yetAnotherButton(View clickedView) { [...] }
Other events 其他事件
AndroidAnnotations supports other kind of events, and it works exactly as with
@Click
.
AndroidAnnotations
支持其他类型的事件,和
@Click
类似。
Currently,
AndroidAnnotations supports the following events on views:
目前,
AndroidAnnotations
支持如下这些
events
视图事件:
- Clicks with
@Click
- Long clicks with
@LongClick
- Touches with
@Touch