當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。