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


Java ViewCompat.canScrollHorizontally方法代码示例

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


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

示例1: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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--) {
      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 && ViewCompat.canScrollHorizontally(v, -dx);
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:31,代码来源:SlidingUpPanelLayout.java

示例2: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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 along the X axis
 * @param dy     Delta scrolled in pixels along the Y axis
 * @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 dy, 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, dy, x + scrollX - child.getLeft(),
                            y + scrollY - child.getTop())) {
                return true;
            }
        }
    }

    return checkV && (ViewCompat.canScrollHorizontally(v, -dx) ||
            ViewCompat.canScrollVertically(v, -dy));
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:36,代码来源:ViewDragHelper.java

示例3: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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 && ViewCompat.canScrollHorizontally(v, (-dx));
}
 
开发者ID:Jusenr,项目名称:RX_Demo,代码行数:34,代码来源:ResideLayout.java

示例4: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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 && ViewCompat.canScrollHorizontally(v, -dx);
}
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:34,代码来源:ViewPagerEx.java

示例5: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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--) {
            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 && ViewCompat.canScrollHorizontally(v, -dx);
}
 
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:31,代码来源:SlidingUpPanelLayout.java

示例6: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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--) {
			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 && ViewCompat.canScrollHorizontally(v, -dx);
}
 
开发者ID:6ag,项目名称:LiuAGeAndroid,代码行数:32,代码来源:CustomViewAbove.java

示例7: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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 along the X axis
 * @param dy Delta scrolled in pixels along the Y axis
 * @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 dy, 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, dy, x + scrollX - child.getLeft(),
                            y + scrollY - child.getTop())) {
                return true;
            }
        }
    }

    return checkV && (ViewCompat.canScrollHorizontally(v, -dx) ||
            ViewCompat.canScrollVertically(v, -dy));
}
 
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:36,代码来源:ViewDragHelper.java

示例8: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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;
			}
		}
	}
	// Modified by shihao. ViewCompat.canScrollHorizontally is not working
	// for version lower than ICE_CREAM_SANDWICH so here we must do ugly
	// hacking.
	return checkV && ViewCompat.canScrollHorizontally(v, dx);
}
 
开发者ID:fengshihao,项目名称:WebPager,代码行数:44,代码来源:CustomViewPager.java

示例9: performAccessibilityAction

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public boolean performAccessibilityAction(Recycler recycler, State state, int action, Bundle args) {
    if (this.mRecyclerView == null) {
        return false;
    }
    int vScroll = 0;
    int hScroll = 0;
    switch (action) {
        case 4096:
            if (ViewCompat.canScrollVertically(this.mRecyclerView, 1)) {
                vScroll = (getHeight() - getPaddingTop()) - getPaddingBottom();
            }
            if (ViewCompat.canScrollHorizontally(this.mRecyclerView, 1)) {
                hScroll = (getWidth() - getPaddingLeft()) - getPaddingRight();
                break;
            }
            break;
        case 8192:
            if (ViewCompat.canScrollVertically(this.mRecyclerView, -1)) {
                vScroll = -((getHeight() - getPaddingTop()) - getPaddingBottom());
            }
            if (ViewCompat.canScrollHorizontally(this.mRecyclerView, -1)) {
                hScroll = -((getWidth() - getPaddingLeft()) - getPaddingRight());
                break;
            }
            break;
    }
    if (vScroll == 0 && hScroll == 0) {
        return false;
    }
    this.mRecyclerView.scrollBy(hScroll, vScroll);
    return true;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:33,代码来源:RecyclerView.java

示例10: onInitializeAccessibilityNodeInfo

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void onInitializeAccessibilityNodeInfo(Recycler recycler, State state, AccessibilityNodeInfoCompat info) {
    if (ViewCompat.canScrollVertically(this.mRecyclerView, -1) || ViewCompat.canScrollHorizontally(this.mRecyclerView, -1)) {
        info.addAction(8192);
        info.setScrollable(true);
    }
    if (ViewCompat.canScrollVertically(this.mRecyclerView, 1) || ViewCompat.canScrollHorizontally(this.mRecyclerView, 1)) {
        info.addAction(4096);
        info.setScrollable(true);
    }
    info.setCollectionInfo(CollectionInfoCompat.obtain(getRowCountForAccessibility(recycler, state), getColumnCountForAccessibility(recycler, state), isLayoutHierarchical(recycler, state), getSelectionModeForAccessibility(recycler, state)));
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:12,代码来源:RecyclerView.java

示例11: canScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的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 along the X axis
 * @param dy     Delta scrolled in pixels along the Y axis
 * @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 dy, 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, dy, x + scrollX - child.getLeft(), y
                    + scrollY - child.getTop())) {
                return true;
            }
        }
    }

    return checkV
            && (ViewCompat.canScrollHorizontally(v, -dx) || ViewCompat.canScrollVertically(v,
            -dy));
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:40,代码来源:ViewDragHelper.java

示例12: determineEdge

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * @return 滑动视图是否到达边缘
 */
private boolean determineEdge(View target, int direction) {
    switch (direction) {
        case StretchView.LEFT:
            return !ViewCompat.canScrollHorizontally(target, -1);
        case StretchView.RIGHT:
            return !ViewCompat.canScrollHorizontally(target, 1);
        case StretchView.BOTTOM:
            return !ViewCompat.canScrollVertically(target, 1);
        default:
            return false;
    }
}
 
开发者ID:thunderpunch,项目名称:StretchView,代码行数:16,代码来源:StretchView.java

示例13: canChildScrollRight

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * 是否能右拉
 *
 * @return
 */
private boolean canChildScrollRight() {
    if (checkListener != null) {
        return checkListener.canScrollRight();
    }
    return ViewCompat.canScrollHorizontally(child, 1);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:12,代码来源:OverScrollLayout.java

示例14: childCanScrollLeft

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public boolean childCanScrollLeft() {
    return ViewCompat.canScrollHorizontally(mScrollChild, 1);
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeBackLayout,代码行数:4,代码来源:SwipeBackLayout.java

示例15: canScrollLeft

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public boolean canScrollLeft(View view) {
    return ViewCompat.canScrollHorizontally(view, 1);
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeToRefreshLayout,代码行数:4,代码来源:SwipeToRefreshLayout.java


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