Created
March 29, 2016 10:20
-
-
Save msomu/cd803bb282ad9c6063c7 to your computer and use it in GitHub Desktop.
Android image place holder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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