Java Code Examples for android.widget.ScrollView#getPaddingTop()

The following examples show how to use android.widget.ScrollView#getPaddingTop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlideBottomPanel.java    From pius1 with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Copy From ScrollView (API Level >= 14)
 * <p>The scroll range of a scroll view is the overall height of all of its
 * children.</p>
 */
private int computeVerticalScrollRange(ScrollView scrollView) {
    final int count = scrollView.getChildCount();
    final int contentHeight = scrollView.getHeight() - scrollView.getPaddingBottom() - scrollView.getPaddingTop();
    if (count == 0) {
        return contentHeight;
    }

    int scrollRange = scrollView.getChildAt(0).getBottom();
    final int scrollY = scrollView.getScrollY();
    final int overScrollBottom = Math.max(0, scrollRange - contentHeight);
    if (scrollY < 0) {
        scrollRange -= scrollY;
    } else if (scrollY > overScrollBottom) {
        scrollRange += scrollY - overScrollBottom;
    }

    return scrollRange;
}
 
Example 2
Source File: Utils.java    From MaterialViewPager with Apache License 2.0 6 votes vote down vote up
static boolean canScroll(View view) {
    if (view instanceof ScrollView) {
        ScrollView scrollView = (ScrollView) view;
        View child = scrollView.getChildAt(0);
        if (child != null) {
            int childHeight = child.getHeight();
            return scrollView.getHeight() < childHeight + scrollView.getPaddingTop() + scrollView.getPaddingBottom();
        }
        return false;
    } else if (view instanceof RecyclerView) {
        RecyclerView recyclerView = (RecyclerView) view;
        int yOffset = recyclerView.computeVerticalScrollOffset();
        return yOffset != 0;
    }
    return true;
}
 
Example 3
Source File: ViewMeasure.java    From firebase-android-sdk with Apache License 2.0 5 votes vote down vote up
public int getDesiredHeight() {
  if (view.getVisibility() == View.GONE) {
    return 0;
  }

  if (view instanceof ScrollView) {
    ScrollView sv = (ScrollView) view;
    return sv.getPaddingBottom() + sv.getPaddingTop() + sv.getChildAt(0).getMeasuredHeight();
  }

  return view.getMeasuredHeight();
}
 
Example 4
Source File: ScrollingUtil.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
public static boolean isScrollViewToBottom(ScrollView scrollView) {
    if (scrollView != null) {
        int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight() - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
        int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
        if (scrollContentHeight == realContentHeight) {
            return true;
        }
    }
    return false;
}
 
Example 5
Source File: ScrollingUtil.java    From TwinklingRefreshLayout with Apache License 2.0 5 votes vote down vote up
public static boolean isScrollViewToBottom(ScrollView scrollView) {
    if (scrollView != null) {
        int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight() - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
        int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
        if (scrollContentHeight == realContentHeight) {
            return true;
        }
    }
    return false;
}
 
Example 6
Source File: BGAScrollingUtil.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isScrollViewToBottom(ScrollView scrollView) {
    if (scrollView != null) {
        int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight() - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
        int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
        if (scrollContentHeight == realContentHeight) {
            return true;
        }
    }
    return false;
}
 
Example 7
Source File: ScrollingUtil.java    From Pas with Apache License 2.0 5 votes vote down vote up
public static boolean isScrollViewToBottom(ScrollView scrollView) {
    if (scrollView != null) {
        int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight() - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
        int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
        if (scrollContentHeight == realContentHeight) {
            return true;
        }
    }
    return false;
}
 
Example 8
Source File: MDRootLayout.java    From talk-android with MIT License 4 votes vote down vote up
private static boolean canScrollViewScroll(ScrollView sv) {
    if (sv.getChildCount() == 0)
        return false;
    final int childHeight = sv.getChildAt(0).getMeasuredHeight();
    return sv.getMeasuredHeight() - sv.getPaddingTop() - sv.getPaddingBottom() < childHeight;
}