2015-06-15 136 views
2

我似乎無法設置我的imageView填滿我的按鈕的整個空間(視圖)。我有一個有白色空間作爲背景的按鈕。ImageView內滾動視圖(Android)

請看看我的樣本

enter image description here

我的代碼:

<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="bottom" > 

      <ScrollView 
       android:id="@+id/scroll" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent"> 

       <RelativeLayout 
        android:id="@+id/relativeLayout1" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" > 

        <ImageView 
       android:id="@+id/imageView21" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scaleType="centerCrop" 
       android:src="@drawable/bg_shkaf" /> 

        </RelativeLayout> 

    </ScrollView> 
</RelativeLayout> 
+0

我同意@Tufan,發佈更多詳細信息... – Aspicas

+2

您是否嘗試設置縮放類型「fitXY」? –

+1

@ShivamVerma他/她已經使用'android:scaleType =「centerCrop」' – Aspicas

回答

1

的滾動視圖使用android:fillViewport="true",改變ImageView規模型向android:scaleType="fitXY"

<RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:gravity="bottom" > 

       <ScrollView 
        android:id="@+id/scroll" 
        android:fillViewport="true" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"> 

        <RelativeLayout 
         android:id="@+id/relativeLayout1" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" > 

         <ImageView 
        android:id="@+id/imageView21" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:scaleType="fitXY" 
        android:src="@drawable/bg_shkaf" /> 

         </RelativeLayout> 



     </ScrollView> 
    </RelativeLayout> 
+0

非常感謝!是工作! – mzb86604

+0

@ mzb86604因爲您有足夠的聲譽而投票贊成:) – Cyanotis