Android ScrollView: automatically scrolls to a few pixels (dips) over a specific view

I know that I have to decide how many pixels are based on density .. not hardcoded.

I have section headings and elements displayed in scrollview, and I want to scroll to a specific section heading (the one that is on the current date), while it’s clear that this is not the top of the screen (show about half the previous element).

How can i do this? I do not want this automatic scroll to be animated.

+3
source share
1 answer

View.requestRectangleOnScreen() , ( ). , ( ), , ScrollView. , , scrollBy() requestRec....() ( , ).

xml .

- edit: getLeft()/getTop().

+3

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


All Articles