javiersantos / MaterialStyledDialogs

A library that shows a beautiful and customizable Material-based dialog with header. API 14+ required.
Apache License 2.0
1.17k stars 155 forks source link

using a RecyclerView as a custom view #21

Closed herghost closed 8 years ago

herghost commented 8 years ago

Can anyone help with this?

LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View Customview = inflater.inflate(R.layout.vh_othersizes,null);
            RecyclerView rvOtheritems = (RecyclerView) Customview.findViewById(R.id.rvOtherSizes);
            OtherSizesAdaptor osa = new OtherSizesAdaptor(allItems, getActivity());
            LinearLayoutManager llm = new LinearLayoutManager(getActivity());
            llm.setOrientation(LinearLayoutManager.VERTICAL);

            rvOtheritems.setLayoutManager(llm);
            rvOtheritems.setAdapter(osa);

            new MaterialStyledDialog(getActivity())
                    .setTitle("Other Sizes")
                    .setCancelable(true)
                    .setIcon(R.drawable.ic_movestock)
                    .withIconAnimation(true)
                    .setHeaderColor(R.color.buttonBlue)
                    .setCancelable(true)
                    .setCustomView(Customview)
                    .build().show();
        });

No errors, the dialog box displays but the RecyclerView doesnt?

herghost commented 8 years ago

Actually I was being silly, I changed vh_othersizes to use linearlayout, not constraintlayout!

frank-vi commented 6 years ago

Hi, I have your same problem, the Recyclerview is not displayed. My layout has a LinearLayout as a root tag and a recyclerview inside it. Can you help me?

My custom_view.xml