How to scroll to show a node?
Hi.
I have a big tree and I need to make a specific node visible (on screen center). In other words, I need scroll to that node programmatically. For example: treeView.scrollTo(node127); Can you help me?
Sorry my bad english.
Thanks!
Sorry for late response, TreeView is just ScrollView so you can work with tree in the same way. You can try to play with scrollTo method
Hi. Sorry but AndroidTreeView not ScrollView... is just Class, so. How to use TreeView like ScrollView ? I need to pass AndroidTreeView.getView() into PlaceHolder, how I can do this.
p.s. Sorry for my bad english. Thanks alot.
AndroidTreeView.getView() is ScrollView, you can check implementation, you should be able to add this to any container. This can be also FrameLayout if you enable 2d scrolling (see example)
Anyone had luck trying this ? scrollViewTreeView?.scrollTo doesn't have any effect
upon using scrollview->scrollTo
if (getChildCount() > 0) {
View child = getChildAt(0);
x = clamp(x, getWidth() - mPaddingRight - mPaddingLeft, child.getWidth());
y = clamp(y, getHeight() - mPaddingBottom - mPaddingTop, child.getHeight());
if (x != mScrollX || y != mScrollY) {
super.scrollTo(x, y);
}
}
getChildCount = 1 and width and height are always the same (total size of scrollView) instead of the child element being focused to
Please see this answer:
https://github.com/bmelnychuk/AndroidTreeView/issues/152#issuecomment-614309243