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


Java RecyclerView.setLayoutParams方法代碼示例

本文整理匯總了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();
        }
    });
}
 
開發者ID:IstiN,項目名稱:android-training-2017,代碼行數:23,代碼來源:CustomSpinner.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:17,代碼來源:DialogHelper.java

示例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;
}
 
開發者ID:harrylefit,項目名稱:eazycore,代碼行數:9,代碼來源:BaseMainWithDataFragment.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:FastAdapterDialog.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:FastAdapterBottomSheetDialog.java

示例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;
}
 
開發者ID:AlphaBoom,項目名稱:ClassifyView,代碼行數:12,代碼來源:LinearHHClassifyView.java

示例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;
}
 
開發者ID:AlphaBoom,項目名稱:ClassifyView,代碼行數:11,代碼來源:ClassifyView.java

示例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);
}
 
開發者ID:sswukang,項目名稱:RvAdapter,代碼行數:14,代碼來源:SideAndStickyHeaderRecyclerView.java

示例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);
}
 
開發者ID:by-syk,項目名稱:NanoIconPackLite,代碼行數:14,代碼來源:LiteIconActivityV1.java

示例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);
}
 
開發者ID:by-syk,項目名稱:NanoIconPackLite,代碼行數:28,代碼來源:LiteIconActivityV2.java

示例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;
}
 
開發者ID:AlphaBoom,項目名稱:ClassifyView,代碼行數:12,代碼來源:LinearHHClassifyView.java

示例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);
}
 
開發者ID:ApplikeySolutions,項目名稱:CosmoCalendar,代碼行數:14,代碼來源:CalendarView.java

示例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;
}
 
開發者ID:AlphaBoom,項目名稱:ClassifyView,代碼行數:11,代碼來源:ClassifyView.java

示例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;
}
 
開發者ID:AlphaBoom,項目名稱:ClassifyView,代碼行數:12,代碼來源:LinearVVClassifyView.java

示例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;
}
 
開發者ID:harrylefit,項目名稱:eazycore,代碼行數:7,代碼來源:BaseMainWithDataFragment.java


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