Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Android] Add scrollToBegin to scroller. (#2165)
Browse files Browse the repository at this point in the history
* feature: if scrooler has attr `scrollToBegin=false`,then   scroller will not scroller to begin position auto when content layout change
* doc pr: [apache/incubator-weex-site#334](apache/incubator-weex-site#334)
  • Loading branch information
lucky-chen authored and YorkShen committed Feb 27, 2019
1 parent 63b9ba2 commit 06c6e27
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,16 @@ public void run() {
int mw = frameLayout.getMeasuredWidth();
scrollView.scrollTo(mw, component.getScrollY());
} else {
scrollView.scrollTo(0, component.getScrollY());
boolean scrollToBegin = true;
Object scrollToBeginOnLTR = getAttrs().get("scrollToBegin");
if (scrollToBeginOnLTR instanceof String){
if("false".equalsIgnoreCase((String)scrollToBeginOnLTR)){
scrollToBegin = false;
}
}
if (scrollToBegin){
scrollView.scrollTo(0, component.getScrollY());
}
}
}
});
Expand Down

0 comments on commit 06c6e27

Please sign in to comment.