Android examples for User Interface:ViewGroup
can ViewGroup Child Scroll Up
//package com.java2s; import android.os.Build; import android.support.v4.view.ViewCompat; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; public class Main { /**/* w w w .j a v a 2 s. c o m*/ * @return Whether it is possible for the child view of this layout to * scroll up. Override this if the child view is a custom view. */ public static boolean canChildScrollUp(ViewGroup viewGroup) { if (viewGroup != null) { View mTarget = viewGroup.getChildAt(0); if (mTarget != null) { if (Build.VERSION.SDK_INT < 14) { if (mTarget instanceof AbsListView) { final AbsListView absListView = (AbsListView) mTarget; return absListView.getChildCount() > 0 && (absListView.getFirstVisiblePosition() > 0 || absListView .getChildAt(0).getTop() < absListView .getPaddingTop()); } else { return ViewCompat.canScrollVertically(mTarget, -1) || mTarget.getScrollY() > 0; } } else { return ViewCompat.canScrollVertically(mTarget, -1); } } } return false; } }