简体   繁体   中英

How to get nestedscrollview can scroll or not?

Is there any way to get that nestedscrollview have some element for scroll or not. I want to put some down arrow indication in app in which user will indicate through a down arrow if it's having item for scroll.

Inpired by code from https://stackoverflow.com/a/18574328/7384780 . You can do it like this.

NestedScrollView scrollView = findViewById(R.id.nestedScrollView);
int childHeight = ((LinearLayout)findViewById(R.id.scrollContent)).getHeight();
boolean isScrollable = scrollView.getHeight() < childHeight + 
scrollView.getPaddingTop() + scrollView.getPaddingBottom();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM