Java Code Examples for android.view.View.canScrollHorizontally()

The following are Jave code examples for showing how to use canScrollHorizontally() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: recycler-view-pager   File: RecyclerViewPager.java   Source Code and License Vote up 6 votes
/**
 * Tests scrollability within child views of v given a delta of dx.
 *
 * @param v      View to test for horizontal scrollability
 * @param checkV Whether the view v passed should itself be checked for scrollability (true),
 *               or just its children (false).
 * @param dx     Delta scrolled in pixels
 * @param x      X coordinate of the active touch point
 * @param y      Y coordinate of the active touch point
 * @return true if child views of v can be scrolled by delta of dx.
 */
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
    if (v instanceof ViewGroup) {
        final ViewGroup group = (ViewGroup) v;
        final int scrollX = v.getScrollX();
        final int scrollY = v.getScrollY();
        final int count = group.getChildCount();
        // Count backwards - let topmost views consume scroll distance first.
        for (int i = count - 1; i >= 0; i--) {
            // TODO: Add versioned support here for transformed views.
            // This will not work for transformed views in Honeycomb+
            final View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight()
                    && y + scrollY >= child.getTop() && y + scrollY < child.getBottom()
                    && canScroll(child, true, dx, x + scrollX - child.getLeft(),
                    y + scrollY - child.getTop())) {
                return true;
            }
        }
    }

    return checkV && v.canScrollHorizontally(-dx);
}
 
Example 2
Project: SmoothRefreshLayout   File: HorizontalScrollCompat.java   Source Code and License Vote up 4 votes
public static boolean canChildScrollLeft(View view) {
    if (Build.VERSION.SDK_INT < 26)
        return ViewCompat.canScrollHorizontally(view, -1);
    else
        return view.canScrollHorizontally(-1);
}
 
Example 3
Project: SmoothRefreshLayout   File: HorizontalScrollCompat.java   Source Code and License Vote up 4 votes
public static boolean canChildScrollRight(View view) {
    if (Build.VERSION.SDK_INT < 26)
        return ViewCompat.canScrollHorizontally(view, 1);
    else
        return view.canScrollHorizontally(1);
}
 
Example 4
Project: letv   File: ViewCompatICS.java   Source Code and License Vote up 4 votes
public static boolean canScrollHorizontally(View v, int direction) {
    return v.canScrollHorizontally(direction);
}
 
Example 5
Project: boohee_v5.6   File: ViewCompatICS.java   Source Code and License Vote up 4 votes
public static boolean canScrollHorizontally(View v, int direction) {
    return v.canScrollHorizontally(direction);
}
 
Example 6
Project: switchbutton   File: FTouchHelper.java   Source Code and License Vote up 2 votes
/**
 * view是否已经滚动到最左边
 *
 * @param view
 * @return
 */
public static boolean isScrollToLeft(View view)
{
    return !view.canScrollHorizontally(-1);
}
 
Example 7
Project: switchbutton   File: FTouchHelper.java   Source Code and License Vote up 2 votes
/**
 * view是否已经滚动到最右边
 *
 * @param view
 * @return
 */
public static boolean isScrollToRight(View view)
{
    return !view.canScrollHorizontally(1);
}
 
Example 8
Project: windowmanager   File: SDTouchHelper.java   Source Code and License Vote up 2 votes
/**
 * view是否已经滚动到最左边
 *
 * @param view
 * @return
 */
public static boolean isScrollToLeft(View view)
{
    return !view.canScrollHorizontally(-1);
}
 
Example 9
Project: windowmanager   File: SDTouchHelper.java   Source Code and License Vote up 2 votes
/**
 * view是否已经滚动到最右边
 *
 * @param view
 * @return
 */
public static boolean isScrollToRight(View view)
{
    return !view.canScrollHorizontally(1);
}
 
Example 10
Project: pulltorefresh   File: FTouchHelper.java   Source Code and License Vote up 2 votes
/**
 * view是否已经滚动到最左边
 *
 * @param view
 * @return
 */
public static boolean isScrollToLeft(View view)
{
    return !view.canScrollHorizontally(-1);
}
 
Example 11
Project: pulltorefresh   File: FTouchHelper.java   Source Code and License Vote up 2 votes
/**
 * view是否已经滚动到最右边
 *
 * @param view
 * @return
 */
public static boolean isScrollToRight(View view)
{
    return !view.canScrollHorizontally(1);
}