【问题标题】:How to get nestedscrollview can scroll or not?如何让nestedscrollview 可以滚动或不滚动?
【发布时间】:2018-08-13 22:09:06
【问题描述】:

有没有办法让 nestedscrollview 有一些滚动元素。我想在应用程序中放置一些向下箭头指示,如果它有滚动项目,用户将通过向下箭头指示。

【问题讨论】:

    标签: java android scroll android-nestedscrollview


    【解决方案1】:

    受https://stackoverflow.com/a/18574328/7384780 的代码启发。你可以这样做。

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

    【讨论】:

      猜你喜欢
      • 2023-03-05
      • 2022-01-02
      • 2019-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-23
      • 1970-01-01
      相关资源
      最近更新 更多