Resize appearance in recycler

I have a RecyclerView using the default Linear Layout Manager.

llm = new LinearLayoutManager(getActivity().getApplicationContext());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    ItemListView = (RecyclerView) rootView.findViewById(R.id.Itemlist);
    ItemListView.setLayoutManager(llm);
    final float scale = getActivity().getBaseContext().getResources().getDisplayMetrics().density;

I am trying to change the height of this view of a single element to display additional ui elements when the label is clicked.

I tried this without success

vh.itemView.setMinimumHeight((int)(375 *(scale/160)));

Is it possible to change the height of an element? would I need to implement my own layoutManager?

+4
source share
1 answer

Hide additional ui elements from element view first by calling

(some_ui_element).setVisibility(View.GONE);

In an element, click, select the elements by calling

   (some_ui_element).setVisibility(View.VISIBLE);

and make sure that the element’s layout in xml is set to wrap-content for its layout height. The cardview (or listview) element has been modified to display ui elements.

+4

All Articles