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


Java RecyclerView.VERTICAL屬性代碼示例

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


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

示例1: getItemOffsets

/**
 * @since 5.0.0-b4
 */
@SuppressWarnings({"ConstantConditions", "unchecked", "SuspiciousNameCombination"})
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView recyclerView, RecyclerView.State state) {
	int offset = (mDivider != null && withOffset ? mDivider.getIntrinsicHeight() : 0);
	if (mSectionOffset > 0 && recyclerView.getAdapter() instanceof FlexibleAdapter) {
		FlexibleAdapter flexibleAdapter = (FlexibleAdapter) recyclerView.getAdapter();
		int position = recyclerView.getChildAdapterPosition(view);

		//Only ISectionable items can finish with a gap and only if next item is a IHeader item
		if (flexibleAdapter.getItem(position) instanceof ISectionable &&
				(flexibleAdapter.isHeader(flexibleAdapter.getItem(position + 1)) ||
						position >= recyclerView.getAdapter().getItemCount() - 1)) {

			offset += mSectionOffset;
		}
	}
	if (Utils.getOrientation(recyclerView.getLayoutManager()) == RecyclerView.VERTICAL) {
		outRect.set(0, 0, 0, offset);
	} else {
		outRect.set(0, 0, offset, 0);
	}
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:DividerItemDecoration.java

示例2: initViewContainer

public void initViewContainer(Activity activity, int localUid, HashMap<Integer, SurfaceView> uids, boolean isLandscape) {
    boolean newCreated = initAdapter(activity, localUid, uids);

    if (!newCreated) {
        mGridVideoViewContainerAdapter.setLocalUid(localUid);
        mGridVideoViewContainerAdapter.customizedInit(uids, true);
    }

    this.setAdapter(mGridVideoViewContainerAdapter);

    int orientation = isLandscape ? RecyclerView.HORIZONTAL : RecyclerView.VERTICAL;

    int count = uids.size();
    if (count <= 2) { // only local full view or or with one peer
        this.setLayoutManager(new LinearLayoutManager(activity.getApplicationContext(), orientation, false));
    } else if (count > 2) {
        int itemSpanCount = getNearestSqrt(count);
        this.setLayoutManager(new GridLayoutManager(activity.getApplicationContext(), itemSpanCount, orientation, false));
    }

    mGridVideoViewContainerAdapter.notifyDataSetChanged();
}
 
開發者ID:AgoraIO,項目名稱:OpenVideoCall-Android,代碼行數:22,代碼來源:GridVideoViewContainer.java

示例3: onScrolled

@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    int firstVisibleItemPosition = 0;
    RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
    // 判斷layout manager的類型
    int type = judgeLayoutManager(layoutManager);
    // 根據類型來計算出第一個可見的item的位置,由此判斷是否觸發到底部的監聽器
    firstVisibleItemPosition = calculateFirstVisibleItemPos(type, layoutManager, firstVisibleItemPosition);
    // 計算並判斷當前是向上滑動還是向下滑動
    int orientation = getOrientation(type, layoutManager);
    if (orientation == RecyclerView.VERTICAL) {
        calculateScrollUpOrDown(firstVisibleItemPosition, dy);
    } else if (orientation == RecyclerView.HORIZONTAL) {
        calculateScrollUpOrDown(firstVisibleItemPosition, dx);
    }
    // 移動距離超過一定的範圍,我們監聽就沒有啥實際的意義了
    mScrolledXDistance += dx;
    mScrolledYDistance += dy;
    mScrolledXDistance = (mScrolledXDistance < 0) ? 0 : mScrolledXDistance;
    mScrolledYDistance = (mScrolledYDistance < 0) ? 0 : mScrolledYDistance;
    onScrolled(mScrolledXDistance, mScrolledYDistance);
}
 
開發者ID:imliujun,項目名稱:LJFramework,代碼行數:23,代碼來源:OnRcvScrollListener.java

示例4: init

private void init() {
    txtTopTitle.setText("RxJava+Retrofit Demo");

    LinearLayoutManager layout = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
    rlContent.setLayoutManager(layout);

    adapter = new PathListAdapter(null, getContext());
    rlContent.setAdapter(adapter);

    adapter.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(int position) {
            ShowImageActivity.start(getContext(), adapter.getItem(position));
        }
    });
}
 
開發者ID:StickyTolt,項目名稱:ForeverLibrary,代碼行數:16,代碼來源:NetApplyActivity.java

示例5: initFirefoxDataView

private void initFirefoxDataView() {
    final int orientation = RecyclerView.VERTICAL;
    fxDataView.setLayoutManager(new LinearLayoutManager(this, orientation, false));
    fxDataView.addItemDecoration(new DividerItemDecoration(this, orientation));

    historyAdapter = new FirefoxHistoryAdapter();
    fxDataView.setAdapter(historyAdapter);

    fxDataSignOutButton.setOnClickListener(new SignOutOnClickListener());
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:10,代碼來源:FirefoxDataInRecyclerViewExampleActivity.java

示例6: onDraw

/**
 * 畫線
 */
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
    super.onDraw(c, parent, state);
    if (orientation == RecyclerView.HORIZONTAL) {
        drawVertical(c, parent, state);
    } else if (orientation == RecyclerView.VERTICAL) {
        drawHorizontal(c, parent, state);
    }
}
 
開發者ID:GitLqr,項目名稱:MaterialDesignDemo,代碼行數:12,代碼來源:MyDecorationOne.java

示例7: getItemOffsets

/**
 * 設置條目周邊的偏移量
 */
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
    super.getItemOffsets(outRect, view, parent, state);
    if (orientation == RecyclerView.HORIZONTAL) {
        //畫垂直線
        outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
    } else if (orientation == RecyclerView.VERTICAL) {
        //畫水平線
        outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
    }
}
 
開發者ID:GitLqr,項目名稱:MaterialDesignDemo,代碼行數:14,代碼來源:MyDecorationOne.java


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