本文整理汇总了Java中android.widget.ScrollView.getPaddingTop方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollView.getPaddingTop方法的具体用法?Java ScrollView.getPaddingTop怎么用?Java ScrollView.getPaddingTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ScrollView
的用法示例。
在下文中一共展示了ScrollView.getPaddingTop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canScroll
import android.widget.ScrollView; //导入方法依赖的package包/类
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;
}
示例2: computeVerticalScrollRange
import android.widget.ScrollView; //导入方法依赖的package包/类
/**
* 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;
}
示例3: isScrollViewToBottom
import android.widget.ScrollView; //导入方法依赖的package包/类
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;
}
示例4: canScrollViewScroll
import android.widget.ScrollView; //导入方法依赖的package包/类
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;
}