How to set height of recyclerview programmatically? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to set height of recyclerview programmatically? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I tried,

recyclerview.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,100));

But its not working.

Answer

Try to set height like this,

ViewGroup.LayoutParams params=recyclerview.getLayoutParams();
params.height=100;
recyclerview.setLayoutParams(params);
We are here to answer your question about How to set height of recyclerview programmatically? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji