Child View Position in Horizontal ScrollView

I have a HorizontalScrollView with a range of CompoundButtons. I want to find (x, y) for a given child view. I tried using: getLocationOnScreen () getLocalVisibleRect () getChildVisibleRect ()

like this: View tmpView = this.findViewById (viewId); Rect hitRect = new Rect ();
tmpView.getLocalVisibleRect (hitRect);

hitRect is always 0.0 - 0.0.

I need x, y to basically scroll to a specific child view. Any help is appreciated. Thank.

+3
source share
1 answer

getLocalVisibleRect() OnCreate? , getLocalVisibleRect, OnCreate .

+1

Source: https://habr.com/ru/post/1746007/


All Articles