當前位置: 首頁>>代碼示例>>Java>>正文


Java AbsListView.getPaddingTop方法代碼示例

本文整理匯總了Java中android.widget.AbsListView.getPaddingTop方法的典型用法代碼示例。如果您正苦於以下問題:Java AbsListView.getPaddingTop方法的具體用法?Java AbsListView.getPaddingTop怎麽用?Java AbsListView.getPaddingTop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.AbsListView的用法示例。


在下文中一共展示了AbsListView.getPaddingTop方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
     * @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 boolean canChildScrollUp() {
//        //For make it can work when my recycler view is in Gone.
//        return false;
        if (android.os.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);
        }
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:SwipeRefreshLayout.java

示例2: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
public boolean canChildScrollUp() {
    boolean z = false;
    if (VERSION.SDK_INT >= 14) {
        return ViewCompat.canScrollVertically(this.mTarget, -1);
    }
    if (this.mTarget instanceof AbsListView) {
        AbsListView absListView = this.mTarget;
        if (absListView.getChildCount() <= 0 || (absListView.getFirstVisiblePosition() <= 0 && absListView.getChildAt(0).getTop() >= absListView.getPaddingTop())) {
            return false;
        }
        return true;
    }
    if (ViewCompat.canScrollVertically(this.mTarget, -1) || this.mTarget.getScrollY() > 0) {
        z = true;
    }
    return z;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:18,代碼來源:SwipeRefreshLayout.java

示例3: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * 用來判斷是否可以下拉
 */
public static boolean canChildScrollUp(View mChildView) {
    if (mChildView == null) {
        return false;
    }
    if (Build.VERSION.SDK_INT < 14) {
        if (mChildView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mChildView;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return ViewCompat.canScrollVertically(mChildView, -1) || mChildView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mChildView, -1);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:ScrollingUtil.java

示例4: canViewScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * Utility method to check whether a {@link View} can scroll up from it's current position.
 * Handles platform version differences, providing backwards compatible functionality where
 * needed.
 */
private static boolean canViewScrollUp(View view) {
    if (android.os.Build.VERSION.SDK_INT >= 14) {
        // For ICS and above we can call canScrollVertically() to determine this
        return ViewCompat.canScrollVertically(view, -1);
    } else {
        if (view instanceof AbsListView) {
            // Pre-ICS we need to manually check the first visible item and the child view's top
            // value
            final AbsListView listView = (AbsListView) view;
            return listView.getChildCount() > 0 &&
                    (listView.getFirstVisiblePosition() > 0
                            || listView.getChildAt(0).getTop() < listView.getPaddingTop());
        } else {
            // For all other view types we just check the getScrollY() value
            return view.getScrollY() > 0;
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:MultiSwipeRefreshLayout.java

示例5: canScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
public static boolean canScrollUp(View targetView) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (targetView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) targetView;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return targetView.getScrollY() > 0;
        }
    } else {
        return targetView.canScrollVertically(-1);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:ScrollBoundaryUtil.java

示例6: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
public static boolean canChildScrollUp(View view) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;

            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {

            return view.getScrollY() > 0;
        }
    } else {
        return view.canScrollVertically(-1);
    }
}
 
開發者ID:qianxinyi,項目名稱:DripUltraRefreshWithLoad,代碼行數:17,代碼來源:PtrDefaultRefreshLoadHandler.java

示例7: absListViewCanScrollList

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * Copy From AbsListView (API Level >= 19)
 * @param absListView AbsListView
 * @param direction Negative to check scrolling up, positive to check
 *                  scrolling down.
 * @return true if the list can be scrolled in the specified direction,
 *         false otherwise
 */
private boolean absListViewCanScrollList(AbsListView absListView,int direction) {
    final int childCount = absListView.getChildCount();
    if (childCount == 0) {
        return false;
    }
    final int firstPosition = absListView.getFirstVisiblePosition();
    if (direction > 0) {//can scroll down
        final int lastBottom = absListView.getChildAt(childCount - 1).getBottom();
        final int lastPosition = firstPosition + childCount;
        return lastPosition < absListView.getCount() || lastBottom > absListView.getHeight() - absListView.getPaddingTop();
    } else {//can scroll  up
        final int firstTop = absListView.getChildAt(0).getTop();
        return firstPosition > 0 || firstTop < absListView.getPaddingTop();
    }
}
 
開發者ID:stytooldex,項目名稱:pius1,代碼行數:24,代碼來源:SlideBottomPanel.java

示例8: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * Whether child view can scroll up
 * @return
 */
public boolean canChildScrollUp() {
  if (mTargetView == null) {
    return false;
  }
  if (Build.VERSION.SDK_INT < 14) {
    if (mTargetView instanceof AbsListView) {
      final AbsListView absListView = (AbsListView) mTargetView;
      return absListView.getChildCount() > 0
             && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                                                                  .getTop() < absListView.getPaddingTop());
    } else {
      return ViewCompat.canScrollVertically(mTargetView, -1) || mTargetView.getScrollY() > 0;
    }
  } else {
    return ViewCompat.canScrollVertically(mTargetView, -1);
  }
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:22,代碼來源:WXSwipeLayout.java

示例9: isChildScrollToTop

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * 判斷目標View是否滑動到頂部-還能否繼續滑動
 *
 * @return
 */
public boolean isChildScrollToTop() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return !ViewCompat.canScrollVertically(mTarget, -1);
    } else{
        if (mTarget instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTarget;
            return !(absListView.getChildCount() > 0 && (absListView
                    .getFirstVisiblePosition() > 0 || absListView
                    .getChildAt(0).getTop() < absListView.getPaddingTop()));
        } else if (mTarget instanceof RecyclerView){
            return SuperSwipeHelper.isAtTop((RecyclerView) mTarget);
        } else {
            return !(mTarget.getScrollY() > 0);
        }
    }
}
 
開發者ID:FreeSunny,項目名稱:Amazing,代碼行數:22,代碼來源:SuperSwipeRefreshLayout.java

示例10: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * @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 boolean canChildScrollUp() {
    if (android.os.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);
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:19,代碼來源:LingjuSwipeRefreshLayout.java

示例11: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * 判斷View是否可以上拉
 * @return canChildScrollUp
 */
public boolean canChildScrollUp() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        if (mTargetView instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) mTargetView;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return ViewCompat.canScrollVertically(mTargetView, -1) || mTargetView.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTargetView, -1);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:SlidingLayout.java

示例12: canChildPullDown

import android.widget.AbsListView; //導入方法依賴的package包/類
/**
 * @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 boolean canChildPullDown() {
    if (child instanceof AbsListView) {
        final AbsListView absListView = (AbsListView) child;
        return canScrollVertically(child, -1)
                || absListView.getChildCount() > 0
                && (absListView.getFirstVisiblePosition() > 0 || absListView
                .getChildAt(0).getTop() < absListView
                .getPaddingTop());
    } else {
        return canScrollVertically(child, -1) || child.getScrollY() > 0;
    }
}
 
開發者ID:LonelyMushroom,項目名稱:aarLibrary,代碼行數:17,代碼來源:XRefreshContentView.java

示例13: isAbsListViewToTop

import android.widget.AbsListView; //導入方法依賴的package包/類
public static boolean isAbsListViewToTop(AbsListView absListView) {
    if (absListView != null) {
        int firstChildTop = 0;
        if (absListView.getChildCount() > 0) {
            // 如果AdapterView的子控件數量不為0,獲取第一個子控件的top
            firstChildTop = absListView.getChildAt(0).getTop() - absListView.getPaddingTop();
        }
        if (absListView.getFirstVisiblePosition() == 0 && firstChildTop == 0) {
            return true;
        }
    }
    return false;
}
 
開發者ID:Justson,項目名稱:AgentWebX5,代碼行數:14,代碼來源:ScrollingUtil.java

示例14: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
public static boolean canChildScrollUp(View view) {
    if (android.os.Build.VERSION.SDK_INT < 14) {
        if (view instanceof AbsListView) {
            final AbsListView absListView = (AbsListView) view;
            return absListView.getChildCount() > 0
                    && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
                    .getTop() < absListView.getPaddingTop());
        } else {
            return view.getScrollY() > 0;
        }
    } else {
        return view.canScrollVertically(-1);
    }
}
 
開發者ID:yinyiliang,項目名稱:RabbitCloud,代碼行數:15,代碼來源:PtrDefaultHandler.java

示例15: canChildScrollUp

import android.widget.AbsListView; //導入方法依賴的package包/類
public boolean canChildScrollUp() {
    if (android.os.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 mTarget.getScrollY() > 0;
        }
    } else {
        return ViewCompat.canScrollVertically(mTarget, -1);
    }
}
 
開發者ID:shenhuanet,項目名稱:AndroidOpen,代碼行數:14,代碼來源:SwipeToRefreshLayout.java


注:本文中的android.widget.AbsListView.getPaddingTop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。