Reputation: 1
I'm developing an android app which requires an imageview (and textviews) to be updated on button click, but I want the image to match the height of four of my textviews. When I set the height of the imageview, it seems to keep the height of the previous update, not the current one. Here is my code to update the image and its height.
int nameHeight = t_name.getHeight();
int timeHeight = r_time.getHeight();
int dateHeight = r_date.getHeight();
int locaHeight = r_loca.getHeight();
int totalHeight = nameHeight + timeHeight + dateHeight + locaHeight;
i_img.getLayoutParams().height = totalHeight;
Bitmap image = getBitmapFromURL(event_image.get(eventToUse));
i_img.setImageBitmap(image);
Upvotes: 0
Views: 47
Reputation: 152867
After touching the layout params, call requestLayout()
to have the changes take effect.
Upvotes: 1