-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
如果SimpleSilder放在一个可以滑动的控件里,SimplerSlider在不可见时是没有必要滚动的,所以
private boolean initAutoCycling = autoCycling;
private boolean firstSetAuto = true;
public void setAutoCycling(boolean autoCycling) {
this.autoCycling = autoCycling;
if (firstSetAuto) {
firstSetAuto = false;
initAutoCycling = autoCycling;
}
if (autoCycling) startAutoCycling();
else stopAutoCycling();
}
@Override
protected void onWindowVisibilityChanged(int visibility) {
super.onWindowVisibilityChanged(visibility);
if (visibility == View.VISIBLE) {
if (initAutoCycling) {
setAutoCycling(true);
}
} else if (visibility == INVISIBLE || visibility == GONE) {
if (initAutoCycling) {
setAutoCycling(false);
}
}
}
Metadata
Metadata
Assignees
Labels
No labels