Skip to content

Instantly share code, notes, and snippets.

@redleafar
Last active February 12, 2018 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redleafar/bebedd2b040c3e84e0871d7ee3688bdd to your computer and use it in GitHub Desktop.
Save redleafar/bebedd2b040c3e84e0871d7ee3688bdd to your computer and use it in GitHub Desktop.
Unable to set layout width, height and weight of inflated view in XML in Android

Use:

View preview = layoutInflater.inflate(R.layout.item_cm_preview_image,parent,false);

and not:

View preview = layoutInflater.inflate(R.layout.item_cm_preview_image,null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment