简体   繁体   English

如何获取nestedscrollview是否可以滚动?

[英]How to get nestedscrollview can scroll or not?

Is there any way to get that nestedscrollview have some element for scroll or not. 有什么办法可以使nestedscrollview有一些滚动元素。 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 . 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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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