Here is my code
onCreate()
{
img = (ImageView)findViewById(R.id.img);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int w = size.x;
int h = w * (9/16);
img.getLayoutParams().height = h;
img.getLayoutParams().width = w;
img.requestLayout();
//The rest of the code spawns a new thread and downloads an image for the image view.
}
and yeah I tried using the FrameLayout Params too (as my ImageView is in a FrameLayout), something like this img.setLayoutParams(new FrameLayout.LayoutParams(w,h)), didn't work
Well what Im trying to do is irrespective of the Image/Image SIZE being downloaded, I want to create an ImageView with w:h = 16:9 ratio. What is the problem with my logic? I tried doing an img.requestLayout() too, didn't work, moved the code to onAttachWindow(), didn't work. Whats the problem here? Would really appreciate any help. Thanks.