本文整理匯總了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);
}
}
示例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!");
}
示例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;
}