In my activity i am creating a Imageview dynamically. Every time it fetch the image from server create an imageview and set that image.
All images size also not same , so i want to put all images in a particular size.
But its not working. Here is my code bellow,
ImageView imageView = new ImageView(getActivity());
imageView.setImageResource(mContent);
imageView.setPadding(20, 20, 20, 20);
imageView.setMaxWidth(400);
imageView.setMaxHeight(400);
LinearLayout layout = new LinearLayout(getActivity());
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
layout.setGravity(Gravity.CENTER);
layout.addView(imageView);
Simply do this,