2011-11-13 26 views
0

我想要一個佔用屏幕寬度(或佈局)的imagview,但是在視圖周圍似乎有填充物阻止我這樣做。如何設置imageview佔用屏幕寬度?

enter image description here

隨着相應的xml:

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" android:layout_width="match_parent" 
android:layout_height="match_parent" android:weightSum="1"> 
<ImageView android:src="@drawable/icon" android:background="@null" 
    android:layout_height="106dp" android:id="@+id/imageView1" 
    android:layout_weight="0.59" android:layout_width="match_parent"></ImageView> 

</LinearLayout> 
+0

使用機器人:scaleType = 「fitXY」,對於ImageView的。 –

回答

4

的襯墊是來自透明區域上的ndroid圖標。 只需刪除未使用的透明區域或使用其他圖像。

0

嘗試改變:

android:layout_width="match_parent" 

到:

android:layout_width="fill_parent" 
+0

沒有這樣的運氣;似乎沒有任何影響。 – Sheldon

+0

@Sheldon你有沒有在兩種設置中改變它? LinearLayout和imageView? –

+0

是的,編輯佈局和圖像視圖。 – Sheldon

0

進行佈局的寬度和高度作爲FILL_PARENT

<ImageView android:src="@drawable/icon" android:background="@null" 
android:layout_height="fill_parent" android:id="@+id/imageView1" 
android:layout_weight="1" android:layout_width="fill_parent"></ImageView> 
相關問題