本文整理汇总了Java中android.widget.ScrollView.getChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollView.getChildAt方法的具体用法?Java ScrollView.getChildAt怎么用?Java ScrollView.getChildAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ScrollView
的用法示例。
在下文中一共展示了ScrollView.getChildAt方法的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: canChildPullUp
import android.widget.ScrollView; //导入方法依赖的package包/类
public boolean canChildPullUp() {
if (child instanceof AbsListView) {
AbsListView absListView = (AbsListView) child;
return canScrollVertically(child, 1)
|| absListView.getLastVisiblePosition() != mTotalItemCount - 1;
} else if (child instanceof WebView) {
WebView webview = (WebView) child;
if (webview instanceof XWebView) {
return !((XWebView) webview).isBottom();
} else {
float left = webview.getContentHeight() * webview.getScale();
int right = webview.getHeight() + webview.getScrollY();
return left != right;
}
} else if (child instanceof ScrollView) {
ScrollView scrollView = (ScrollView) child;
View childView = scrollView.getChildAt(0);
if (childView != null) {
return canScrollVertically(child, 1)
|| scrollView.getScrollY() < childView.getHeight() - scrollView.getHeight();
}
} else {
return canScrollVertically(child, 1);
}
return true;
}
示例3: isAtBottom
import android.widget.ScrollView; //导入方法依赖的package包/类
private boolean isAtBottom() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return !ViewCompat.canScrollVertically(mTarget, 1);
} else {
if (mTarget instanceof RecyclerView) {
return SuperSwipeHelper.isAtBottom((RecyclerView) mTarget);
} else if (mTarget instanceof AbsListView) {
final AbsListView absListView = (AbsListView) mTarget;
int count = absListView.getAdapter().getCount();
int firstPos = absListView.getFirstVisiblePosition();
if (firstPos == 0
&& absListView.getChildAt(0).getTop() >= absListView
.getPaddingTop()) {
return false;
}
int lastPos = absListView.getLastVisiblePosition();
if (lastPos > 0 && count > 0 && lastPos == count - 1) {
return true;
}
return false;
} else if (mTarget instanceof ScrollView) {
ScrollView scrollView = (ScrollView) mTarget;
View view = (View) scrollView
.getChildAt(scrollView.getChildCount() - 1);
if (view != null) {
int diff = (view.getBottom() - (scrollView.getHeight() + scrollView
.getScrollY()));
if (diff == 0) {
return true;
}
}
}
return false;
}
}
示例4: svPullUpIntercept
import android.widget.ScrollView; //导入方法依赖的package包/类
public boolean svPullUpIntercept(View child) {
boolean intercept = false;
ScrollView scrollView = (ScrollView) child;
View scrollChild = scrollView.getChildAt(0);
if (scrollView.getScrollY() >= (scrollChild.getHeight() - scrollView.getHeight())) {
intercept = true;
}
return intercept;
}