title: Android: imageSwitcher fit on screen
body: <p>I have a problem with imageswitcher to fit on screen. Please check PIC 1. There is still white <strong>free space</strong> on the edge of the screen. I want to achieve the effect in PIC 2. There is no empty space and imageswitcher perfect fit to screen. I can do this efect with imageView using:</p>
  
  <pre><code>android:scaleType="centerCrop"
  </code></pre>
  
  <p>but it looks <strong>centerCrop</strong> doesn't works with imageSwitcher. 
  Thanks for any idea how to fix it.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Here is my XML code:
  I added there  <strong>android:scaleType="fitXY"</strong> but it didn't help.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;ImageSwitcher
          android:id="@+id/imageswitcher"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:scaleType="fitXY"
          android:src="@drawable/it_intro1" &gt;
      &lt;/ImageSwitcher&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/fj2PM.png" alt="enter image description here"></p>
  
  <p><strong>SOLUTION:</strong>
  finally it helped add this line of code: <strong>imageView.setScaleType(ImageView.ScaleType.FIT_XY);</strong></p>
  
  <pre><code>public View makeView() {
  
              ImageView imageView = new ImageView(Introduction.this);
               imageView.setScaleType(ImageView.ScaleType.FIT_XY);
  
              LayoutParams params = new ImageSwitcher.LayoutParams(
                      LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
  
              imageView.setLayoutParams(params);
              return imageView;
  
          }
  </code></pre>