@Target(value=METHOD)
@Retention(value=CLASS)
public @interface OnPageChange
OnPageChangeListener on the view for each ID specified.
@OnPageChange(R.id.example_pager) void onPageSelected(int position) {
Toast.makeText(this, "Selected " + position + "!", Toast.LENGTH_SHORT).show();
}
Any number of parameters from onPageSelected may be used on the method.
To bind to methods other than onPageSelected, specify a different callback.
@OnPageChange(value = R.id.example_pager, callback = PAGE_SCROLL_STATE_CHANGED)
void onPageStateChanged(int state) {
Toast.makeText(this, "State changed: " + state + "!", Toast.LENGTH_SHORT).show();
}
| Modifier and Type | Optional Element and Description |
|---|---|
OnPageChange.Callback |
callback
Listener callback to which the method will be bound.
|
int[] |
value
View IDs to which the method will be bound.
|
@IdRes public abstract int[] value
public abstract OnPageChange.Callback callback