Skip to content Skip to sidebar Skip to footer

Height And View Of Imageview Screws Up After Setimagebitmap

Here's my XML:

Solution 1:

I had the same issue! Was going crazy, setImageBitmap completely ignores the layout weight. I also added the setting of the weight programmatically:

barcode.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 2));

but did not help. But then I did this:

barcode.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1, 2));

and that helped, not giving a '0' value for the height. I just tried this out on lollipop, so haven't tested in on older version, but will probably work. Frustating, took me too long again to figure out some workaround for an Android quirk

Post a Comment for "Height And View Of Imageview Screws Up After Setimagebitmap"