Can anyone help me how to set the width of TextView to wrap_content through code and not from XML?
TextView
wrap_content
I am dynamically creating a TextVi
TextVi
I think this code answer your question
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) holder.desc1.getLayoutParams(); params.height = RelativeLayout.LayoutParams.WRAP_CONTENT; holder.desc1.setLayoutParams(params);