How To maintain the aspect ratio of image like 3:4 show on portrait then this image should be convert 9:16 when move device in landscape and image should not be stretched. Hoe can maintain this please help me thanks advance.
My code are And this image i want to set on image switcher. How to maintain every image that is set on imageswicher should be aspect ratio.
public View makeView() {
ImageView imageView = new ImageView(this);
imageView.setAdjustViewBounds(true);
WindowManager window = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
Display display = window.getDefaultDisplay();
imageView.setLayoutParams(new ImageSwitcher.LayoutParams(
display.getWidth(), LayoutParams.FILL_PARENT));
imageView.setBackgroundResource(R.drawable.border);
imageView.setPadding(8, 8, 8, 8);
imageView.setImageBitmap(image);
imageView.setScaleType(ScaleType.FIT_XY);
}