I've been trying to set the height of an ImageView programmatically in Java, but when I launch it, it just disappears.
The code is similar to the following
ImageView img = (ImageView)findViewById(R.id.image);
img.setImageResource(picture[i];
DisplayMetrics dm = new DisplayMetrics();
int width = dm.widhtPixels;
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width, width/3);
img.setLayoutParams(layoutParams);
Maybe I have to append that the image and another text (which isn't mentioned in the code) are given to a CustomAdapter to create a ListView.
Thank you for your help :-)