Skip to content

Instantly share code, notes, and snippets.

@msomu
Created March 29, 2016 10:20
Show Gist options
  • Select an option

  • Save msomu/cd803bb282ad9c6063c7 to your computer and use it in GitHub Desktop.

Select an option

Save msomu/cd803bb282ad9c6063c7 to your computer and use it in GitHub Desktop.
Android image place holder
RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) holder.image.getLayoutParams();
float ratio = item.getHeight() / item.getWidth();
rlp.height = (int) (rlp.width * ratio);
holder.image.setLayoutParams(rlp);
Picasso.with(holder.image.getContext()).load(item.getPic()).into(holder.image);
holder.text.setText(item.getName());
holder.itemView.setTag(item);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment