本文整理匯總了Java中android.support.v7.widget.RecyclerView.setLayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.setLayoutParams方法的具體用法?Java RecyclerView.setLayoutParams怎麽用?Java RecyclerView.setLayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.setLayoutParams方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: show
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void show() {
RecyclerView recyclerView = new RecyclerView(getContext());
recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
popupWindow = new PopupWindow(recyclerView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
popupWindow.showAsDropDown(this);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
if (onItemSelectedListener != null) {
onItemSelectedListener.onNothingSelected();
}
dismiss();
}
});
}
示例2: getRecyclerViewDialog
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public static AlertDialog.Builder getRecyclerViewDialog(Context context, BaseRecyclerAdapter.OnItemClickListener listener) {
RecyclerView recyclerView = new RecyclerView(context);
RecyclerView.LayoutParams params =
new GridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
recyclerView.setPadding(Util.dipTopx(context, 16), Util.dipTopx(context, 16),
Util.dipTopx(context, 16), Util.dipTopx(context, 16));
recyclerView.setLayoutParams(params);
recyclerView.setLayoutManager(new GridLayoutManager(context, 3));
CommentItemAdapter adapter = new CommentItemAdapter(context);
adapter.setOnItemClickListener(listener);
recyclerView.setAdapter(adapter);
recyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
return getDialog(context)
.setView(recyclerView)
.setPositiveButton(null, null);
}
示例3: createGridRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
protected RecyclerView createGridRecyclerView() {
RecyclerView gridRecyclerView = new AutoFitGridRecyclerView(getContext(), spanCountForGridLayout());
gridRecyclerView.setLayoutParams(generateLayoutParamsForRecyclerView());
gridRecyclerView.setHasFixedSize(true);
gridRecyclerView.setClipToPadding(false);
swipeRefresh.addView(gridRecyclerView);
return gridRecyclerView;
}
示例4: createRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
* Create the RecyclerView and set it as the dialog view.
*
* @return the created RecyclerView
*/
private RecyclerView createRecyclerView() {
RecyclerView recyclerView = new RecyclerView(getContext());
RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
recyclerView.setLayoutParams(params);
setView(recyclerView);
return recyclerView;
}
示例5: createRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
* Create the RecyclerView and set it as the dialog view.
*
* @return the created RecyclerView
*/
private RecyclerView createRecyclerView() {
RecyclerView recyclerView = new RecyclerView(getContext());
RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
recyclerView.setLayoutParams(params);
setContentView(recyclerView);
return recyclerView;
}
示例6: getMain
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@NonNull
@Override
protected RecyclerView getMain(Context context, AttributeSet parentAttrs) {
RecyclerView recyclerView = new RecyclerView(context);
recyclerView.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
recyclerView.setLayoutManager(new LinearLayoutManager(context,LinearLayoutManager.HORIZONTAL,false));
RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator();
itemAnimator.setChangeDuration(10);
recyclerView.setItemAnimator(itemAnimator);
return recyclerView;
}
示例7: getSub
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@NonNull
protected RecyclerView getSub(Context context, AttributeSet parentAttrs) {
RecyclerView recyclerView = new RecyclerView(context);
recyclerView.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
recyclerView.setLayoutManager(new GridLayoutManager(context, mSubSpanCount));
RecyclerView.ItemAnimator itemAnimator = new ClassifyItemAnimator();
itemAnimator.setChangeDuration(CHANGE_DURATION);
recyclerView.setItemAnimator(itemAnimator);
return recyclerView;
}
示例8: init
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void init() {
recyclerView = new RecyclerView(getContext());
recyclerView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
addView(recyclerView);
sideBar = new SideBar(getContext());
sideBar.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
sideBar.setPadding(0, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
8, getResources().getDisplayMetrics()), 0);
addView(sideBar);
linkageMove(false);
}
示例9: init
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void init() {
setTheme(android.R.style.Theme_DeviceDefault_Wallpaper);
displayMetrics = getResources().getDisplayMetrics();
recyclerView = new RecyclerView(this);
ViewGroup.LayoutParams lpRv = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
recyclerView.setLayoutParams(lpRv);
recyclerView.setLayoutManager(new GridLayoutManager(this, calculateGridNum()));
setContentView(recyclerView);
}
示例10: init
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void init() {
setTheme(android.R.style.Theme_DeviceDefault_Wallpaper);
displayMetrics = getResources().getDisplayMetrics();
adapter = new IconAdapter();
layoutManager = new GridLayoutManager(this, calculateGridNum());
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return adapter.isCate(position) ? layoutManager.getSpanCount() : 1;
}
});
RecyclerView recyclerView = new RecyclerView(this);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
ViewGroup.LayoutParams lpRv = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
recyclerView.setLayoutParams(lpRv);
recyclerView.setBackgroundColor(0x80808080); // 保證圖標視覺
setContentView(recyclerView);
}
示例11: getSub
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@NonNull
@Override
protected RecyclerView getSub(Context context, AttributeSet parentAttrs) {
RecyclerView recyclerView = new RecyclerView(context);
recyclerView.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
recyclerView.setLayoutManager(new LinearLayoutManager(context,LinearLayoutManager.HORIZONTAL,false));
RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator();
itemAnimator.setChangeDuration(10);
recyclerView.setItemAnimator(itemAnimator);
return recyclerView;
}
示例12: createMultipleSelectionBarRecycler
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
* Creates recycler view to display selected days in bottom selection bar
* Visible only for Multiple selection mode
*/
private void createMultipleSelectionBarRecycler() {
rvMultipleSelectedList = new RecyclerView(getContext());
rvMultipleSelectedList.setId(View.generateViewId());
rvMultipleSelectedList.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
rvMultipleSelectedList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
multipleSelectionBarAdapter = new MultipleSelectionBarAdapter(this, this);
rvMultipleSelectedList.setAdapter(multipleSelectionBarAdapter);
flBottomSelectionBar.addView(rvMultipleSelectedList);
}
示例13: getMain
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@NonNull
protected RecyclerView getMain(Context context, AttributeSet parentAttrs) {
RecyclerView recyclerView = new RecyclerView(context);
recyclerView.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
recyclerView.setLayoutManager(new GridLayoutManager(context, mMainSpanCount));
RecyclerView.ItemAnimator itemAnimator = new ClassifyItemAnimator();
itemAnimator.setChangeDuration(CHANGE_DURATION);
recyclerView.setItemAnimator(itemAnimator);
return recyclerView;
}
示例14: getMain
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@NonNull
@Override
protected RecyclerView getMain(Context context, AttributeSet parentAttrs) {
RecyclerView recyclerView = new RecyclerView(context);
recyclerView.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
recyclerView.setLayoutManager(new LinearLayoutManager(context));
RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator();
itemAnimator.setChangeDuration(10);
recyclerView.setItemAnimator(itemAnimator);
return recyclerView;
}
示例15: createNormalRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
protected RecyclerView createNormalRecyclerView() {
RecyclerView normalRecyclerView = new RecyclerView(getContext());
normalRecyclerView.setLayoutParams(generateLayoutParamsForRecyclerView());
swipeRefresh.addView(normalRecyclerView);
return normalRecyclerView;
}