Java tutorial
//package com.java2s; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Point; import android.os.Build; import android.view.Display; import android.view.WindowManager; import android.widget.ImageView; public class Main { @SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public static void resizeImageView(Context ctx, ImageView imgView) { WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); int width; // int height; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) { width = display.getWidth(); // deprecated // height = display.getHeight(); // deprecated } else { Point size = new Point(); display.getSize(size); width = size.x; // height = size.y; } imgView.setMinimumHeight(width); imgView.setMinimumWidth(width); imgView.getLayoutParams().height = width; imgView.getLayoutParams().width = width; } }