当前位置: 首页>>代码示例>>Java>>正文


Java View.canScrollHorizontally方法代码示例

本文整理汇总了Java中android.view.View.canScrollHorizontally方法的典型用法代码示例。如果您正苦于以下问题:Java View.canScrollHorizontally方法的具体用法?Java View.canScrollHorizontally怎么用?Java View.canScrollHorizontally使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.canScrollHorizontally方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canScroll

import android.view.View; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:thaihuynhxyz,项目名称:recycler-view-pager,代码行数:34,代码来源:RecyclerViewPager.java

示例2: canChildScrollLeft

import android.view.View; //导入方法依赖的package包/类
public static boolean canChildScrollLeft(View view) {
    if (Build.VERSION.SDK_INT < 26)
        return ViewCompat.canScrollHorizontally(view, -1);
    else
        return view.canScrollHorizontally(-1);
}
 
开发者ID:dkzwm,项目名称:SmoothRefreshLayout,代码行数:7,代码来源:HorizontalScrollCompat.java

示例3: canChildScrollRight

import android.view.View; //导入方法依赖的package包/类
public static boolean canChildScrollRight(View view) {
    if (Build.VERSION.SDK_INT < 26)
        return ViewCompat.canScrollHorizontally(view, 1);
    else
        return view.canScrollHorizontally(1);
}
 
开发者ID:dkzwm,项目名称:SmoothRefreshLayout,代码行数:7,代码来源:HorizontalScrollCompat.java

示例4: canScrollHorizontally

import android.view.View; //导入方法依赖的package包/类
public static boolean canScrollHorizontally(View v, int direction) {
    return v.canScrollHorizontally(direction);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:ViewCompatICS.java

示例5: isScrollToLeft

import android.view.View; //导入方法依赖的package包/类
/**
 * view是否已经滚动到最左边
 *
 * @param view
 * @return
 */
public static boolean isScrollToLeft(View view)
{
    return !view.canScrollHorizontally(-1);
}
 
开发者ID:zj565061763,项目名称:switchbutton,代码行数:11,代码来源:FTouchHelper.java

示例6: isScrollToRight

import android.view.View; //导入方法依赖的package包/类
/**
 * view是否已经滚动到最右边
 *
 * @param view
 * @return
 */
public static boolean isScrollToRight(View view)
{
    return !view.canScrollHorizontally(1);
}
 
开发者ID:zj565061763,项目名称:switchbutton,代码行数:11,代码来源:FTouchHelper.java


注:本文中的android.view.View.canScrollHorizontally方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。