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


Java RecyclerView.getLayoutParams方法代碼示例

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


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

示例1: HeaderViewHolder

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
HeaderViewHolder(View itemView) {
    super(itemView);
    ButterKnife.bind(this, itemView);
    RecyclerView recyclerView = itemView.findViewById(R.id.recyclerview);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, true));
    recyclerView.setHasFixedSize(true);

    String[] urls = mContext.getResources().getStringArray(R.array.about_social_links);
    if (urls.length == 0) {
        recyclerView.setVisibility(View.GONE);

        subtitle.setPadding(
                subtitle.getPaddingLeft(),
                subtitle.getPaddingTop(),
                subtitle.getPaddingRight(),
                subtitle.getPaddingBottom() + mContext.getResources().getDimensionPixelSize(R.dimen.content_margin));
    } else {
        if (recyclerView.getLayoutParams() instanceof LinearLayout.LayoutParams) {
            LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) recyclerView.getLayoutParams();
            if (urls.length < 7) {
                params.width = LinearLayout.LayoutParams.WRAP_CONTENT;
                params.gravity = Gravity.CENTER_HORIZONTAL;
                recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
            }
        }
        recyclerView.setAdapter(new AboutSocialAdapter(mContext, urls));
    }

    subtitle.setHtml(mContext.getResources().getString(R.string.about_desc));

    CardView card = itemView.findViewById(R.id.card);
    if (!Preferences.get(mContext).isShadowEnabled()) {
        if (card != null) card.setCardElevation(0);

        profile.setShadowRadius(0f);
        profile.setShadowColor(Color.TRANSPARENT);
    }
}
 
開發者ID:danimahardhika,項目名稱:wallpaperboard,代碼行數:40,代碼來源:AboutAdapter.java

示例2: onFinishInflate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mRecyclerView = (RecyclerView) getChildAt(1);
    RelativeLayout.LayoutParams params = (LayoutParams) mRecyclerView.getLayoutParams();
    params.addRule(PullToRefreshLayout.BELOW, R.id.id_refresh_head);
    if (!(mRecyclerView instanceof RecyclerView))
        throw new Error("PullToRefreshLayout childView at position 1 must be RecyclerView!");
}
 
開發者ID:shenhuanet,項目名稱:OpenEyesReading-android,代碼行數:10,代碼來源:PullToRefreshLayout.java

示例3: bindViews

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void bindViews(View rootView) {
    rvData = (RecyclerView) rootView.findViewById(R.id.rvData);
    rvData.getLayoutParams().width = widthDialog == -1 ? (int) (CommonHelper.getScreenWidth() * 0.6) : widthDialog;
    rvData.getLayoutParams().height = heightDialog == -1 ? (int) (CommonHelper.getScreenHeight() * 0.7) : heightDialog;
}
 
開發者ID:harrylefit,項目名稱:eazycore,代碼行數:6,代碼來源:BaseDataDialog.java


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