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


Java RecyclerView.getPaddingLeft方法代碼示例

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


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

示例1: onDrawOver

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();

    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);

        RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();

        int top = child.getBottom() + params.bottomMargin;
        int bottom = top + mDivider.getIntrinsicHeight();

        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:gbl08ma,項目名稱:underlx,代碼行數:19,代碼來源:SimpleDividerItemDecoration.java

示例2: drawVertical

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void drawVertical(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();

    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        android.support.v7.widget.RecyclerView v = new android.support.v7.widget.RecyclerView(parent.getContext());
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:DividerItemDecoration.java

示例3: drawHorizontalLine

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void drawHorizontalLine(Canvas c, RecyclerView parent, RecyclerView.State state){
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++){
        final View child = parent.getChildAt(i);

        //獲得child的布局信息
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)child.getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
        //Log.d("wnw", left + " " + top + " "+right+"   "+bottom+" "+i);
    }
}
 
開發者ID:fergus825,項目名稱:SmartOrnament,代碼行數:17,代碼來源:MyDecoration.java

示例4: drawVertical

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void drawVertical(Canvas c, RecyclerView parent)
{
	final int left = parent.getPaddingLeft();
	final int right = parent.getWidth() - parent.getPaddingRight();

	final int childCount = parent.getChildCount();

	for (int i = 0; i < childCount; i++)
	{
		final View child = parent.getChildAt(i);
		RecyclerView v = new RecyclerView(
				parent.getContext());
		final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
				.getLayoutParams();
		final int top = child.getBottom() + params.bottomMargin;
		final int bottom = top + mDivider.getIntrinsicHeight();
		mDivider.setBounds(left, top, right, bottom);
		mDivider.draw(c);
	}
}
 
開發者ID:HStanN,項目名稱:TakeRest,代碼行數:21,代碼來源:DividerItemDecoration.java

示例5: drawVertical

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void drawVertical(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();

    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        RecyclerView v = new RecyclerView(parent.getContext());
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:DividerItemDecoration.java

示例6: drawHorizontal

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void drawHorizontal(Canvas c, RecyclerView parent) {
  final int top = parent.getPaddingTop();
  final int bottom = parent.getHeight() - parent.getPaddingBottom();
  final int recyclerViewLeft = parent.getPaddingLeft();
  final int recyclerViewRight = parent.getWidth() - parent.getPaddingRight();
  final int childCount = parent.getChildCount();
  for (int i = 0; i < childCount; i++) {
    final View child = parent.getChildAt(i);
    final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
        .getLayoutParams();
    final int left = Math.max(recyclerViewLeft, child.getRight() + params.rightMargin);
    final int right = Math.min(recyclerViewRight, left + mDivider.getIntrinsicWidth());
    mDivider.setBounds(left, top, right, bottom);
    mDivider.draw(c);
  }
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:17,代碼來源:DividerDecoration.java

示例7: onMoved

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void onMoved(RecyclerView recyclerView, ViewHolder viewHolder, int fromPos, ViewHolder target, int toPos, int x, int y) {
    LayoutManager layoutManager = recyclerView.getLayoutManager();
    if (layoutManager instanceof ViewDropHandler) {
        ((ViewDropHandler) layoutManager).prepareForDrop(viewHolder.itemView, target.itemView, x, y);
        return;
    }
    if (layoutManager.canScrollHorizontally()) {
        if (layoutManager.getDecoratedLeft(target.itemView) <= recyclerView.getPaddingLeft()) {
            recyclerView.scrollToPosition(toPos);
        }
        if (layoutManager.getDecoratedRight(target.itemView) >= recyclerView.getWidth() - recyclerView.getPaddingRight()) {
            recyclerView.scrollToPosition(toPos);
        }
    }
    if (layoutManager.canScrollVertically()) {
        if (layoutManager.getDecoratedTop(target.itemView) <= recyclerView.getPaddingTop()) {
            recyclerView.scrollToPosition(toPos);
        }
        if (layoutManager.getDecoratedBottom(target.itemView) >= recyclerView.getHeight() - recyclerView.getPaddingBottom()) {
            recyclerView.scrollToPosition(toPos);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:24,代碼來源:ItemTouchHelper.java

示例8: drawVertical

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void drawVertical(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();

    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:xinpianchang,項目名稱:NSMPlayer-Android,代碼行數:16,代碼來源:DividerItemDecoration.java

示例9: onDraw

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();

    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);
        RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        int top = child.getBottom() + params.bottomMargin;
        int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:16,代碼來源:DividerItemDecoration.java

示例10: getListLeft

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private int getListLeft(RecyclerView view) {
    if (view.getLayoutManager().getClipToPadding()) {
        return view.getPaddingLeft();
    } else {
        return 0;
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:HeaderPositionCalculator.java

示例11: drawVertical

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void drawVertical(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();

    int childCount = parent.getChildCount();

    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:ymqq,項目名稱:CommonFramework,代碼行數:16,代碼來源:DividerItemDecoration.java

示例12: drawHorizontal

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void drawHorizontal(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getMeasuredWidth() - parent.getPaddingRight();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int top = child.getBottom() + layoutParams.bottomMargin;
        final int bottom = top + mDividerHeight;
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:SirLYC,項目名稱:Android-Gank-Share,代碼行數:14,代碼來源:ItemDecoration.java

示例13: drawVertical

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@SuppressLint("NewApi")
    private void drawVertical(Canvas canvas, RecyclerView parent) {
        canvas.save();
        final int left;
        final int right;
        if (parent.getClipToPadding()) {
            left = parent.getPaddingLeft();
            right = parent.getWidth() - parent.getPaddingRight();
            canvas.clipRect(left, parent.getPaddingTop(), right,
                    parent.getHeight() - parent.getPaddingBottom());
        } else {
            left = 0;
            right = parent.getWidth();
        }

        final int childCount = parent.getChildCount();
//        for (int i = 0; i < childCount; i++) {
        // Remove the last divider
        // @By_syk
        for (int i = 0; i < childCount - 1; i++) {
            final View child = parent.getChildAt(i);
            parent.getDecoratedBoundsWithMargins(child, mBounds);
            final int bottom = mBounds.bottom + Math.round(ViewCompat.getTranslationY(child));
            final int top = bottom - mDivider.getIntrinsicHeight();
            mDivider.setBounds(left, top, right, bottom);
            mDivider.draw(canvas);
        }
        canvas.restore();
    }
 
開發者ID:homeii,項目名稱:GxIconAndroid,代碼行數:30,代碼來源:DividerItemDecoration.java

示例14: onDraw

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();
    final int childCount = parent.getChildCount();
    for(int i = 0;i < childCount;i ++){
        final View child = parent.getChildAt(i);
        RecyclerView view = new RecyclerView(parent.getContext());
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left,top,right,bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:NicoLiutong,項目名稱:miaosou,代碼行數:16,代碼來源:DividerItemDecoration.java

示例15: drawVertical

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void drawVertical(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin +
                Math.round(ViewCompat.getTranslationY(child));
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:QMUI,項目名稱:QMUI_Android,代碼行數:16,代碼來源:DividerItemDecoration.java


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