title: I want to put a bitmap inside imageview keeping aspect ratio
body: <p>This is my xml code:</p>
  
  <pre><code>        &lt;ImageView
          android:id="@+id/ColImgPath"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_vertical"
          android:adjustViewBounds="true"
          android:background="@drawable/border"/&gt;
  </code></pre>
  
  <p>and this my java code, that it is inside listview:</p>
  
  <pre><code>ImageView imageView = (ImageView) convertView.findViewById(R.id.ColImgPath);
          imageView.setPadding(5, 5, 5, 5);
              imageView.setVisibility(View.VISIBLE);
      try {
              Bitmap bmp = ((Bitmap) MyArrList.get(position).get("ImageThumBitmap"));
              int bmpx = bmp.getWidth();
              int bmpy = bmp.getHeight();
  
              Log.i("INFO","X: "+bmpx+" Y: "+bmpy);
  
              Bitmap photobitmap1 = Bitmap.createScaledBitmap(bmp, bmpx/2,bmpy/2, true);
              imageView.setImageBitmap(photobitmap1);
              //imageView.setImageBitmap((Bitmap) MyArrList.get(position).get("ImageThumBitmap"));
  
          } catch (Exception e) {
              // When Error
              imageView.setImageResource(android.R.drawable.ic_menu_report_image);
          }
  </code></pre>
  
  <p>The problem is that I want to put the bitmap resized into bitmap but the imageview always appears squared.
  The size of the bitmap is: <code>X: 4160 Y: 3120</code> and the screen size is : <code>WIDTH= 1080 HEIGHT= 1776</code></p>
  
  <p>I want to put the width fill parent and resize the height keeping the aspect ratio. I tried some xml alternatives like `ScaleType.</p>
  
  <p>Someone knows the way to put correctly the bitmap?</p>