title: Scale ImageView using Volley Android
body: <p>Using Volley library and ViewPager to make an image gallery, I have stumbled upon the problem of scalling images if they are width different width and height. Let's say..landscape mode images and portrait mode images. The portrait images show ok, but the landscape ones are cut at width.  THe view Page height i want to set fixed to 300dp, for instance.</p>
  
  <p>I really don't get this... Bellow is my code:</p>
  
  <p><img src="https://i.stack.imgur.com/38BHX.png" alt="enter image description here"></p>
  
  <pre><code>@Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.cell, container, false);
  
          final NetworkImageView imageView = (NetworkImageView) view
                  .findViewById(R.id.imageCell);
  
          RequestQueue queue = VolleySingleton.getInstance(getActivity())
                  .getRequestQueue();
          ImageLoader imageLoader = VolleySingleton.getImageLoader();
          imageLoader.get(photoUrl, new ImageListener() {
  
              public void onErrorResponse(VolleyError error) {
                  imageView.setImageResource(R.drawable.unnamed); 
              }
  
              public void onResponse(ImageContainer response, boolean arg1) {
                  if (response.getBitmap() != null) {
                      imageView.setImageBitmap(response.getBitmap());
                  }
              }
          });
          imageView.setImageUrl(photoUrl, imageLoader);
  
          return view;
      }
  </code></pre>
  
  <p>Cell.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/linearLayout1"
      android:layout_width="match_parent"
      android:layout_height="300dp"
      android:orientation="vertical" &gt;
  
      &lt;com.android.volley.toolbox.NetworkImageView
          android:id="@+id/imageCell"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:adjustViewBounds="true"
          android:background="@drawable/unnamed"
          android:scaleType="centerCrop" /&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="horizontal" &gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/photoPager"
          android:layout_width="match_parent"
          android:layout_height="300dp"
          android:minHeight="100dp"
          android:layout_weight="1"  /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I hope somebody has passed this problem before, any hint would be great. Thank you.</p>