2013-04-10 127 views
3

所以我有這個無法移除的Android活動邊框?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    android:id="@+id/mainParent" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/bgdark" 
    android:orientation="vertical" 
> 
    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="match_parent" 
     android:layout_height="76dp" 
     android:src="@drawable/myheader_250x60" 
    /> 
    <ListView 
     android:id="@+id/mainListview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 
    </ListView> 
</LinearLayout> 

注意現在我已經編輯這篇文章。我使用的是灰色背景圖片,所以我認爲這是標題圖片右側/左側可見的內容。請參閱下面的圖片以顯示問題。

但是,將背景移動到列表視圖並不能解決問題。因此,它看起來像是一個灰色的左/右邊框。由於我已將寬度設置爲「match_parent」,因此應該佔用最大寬度。

enter image description here

的問題是,到頭部的頂部/右側有一個灰色像素的邊框?如果可能,我想刪除它。

+3

提供屏幕截圖 - 這將有助於 – jimpanzer 2013-04-10 11:25:35

+0

我編輯我的答案。 – jimpanzer 2013-04-10 11:54:27

回答

1

嘗試scaleType attribute爲您的ImageView。

Anothrer方式 - 更換

android:src="@drawable/myheader_250x60" 

android:background="@drawable/myheader_250x60" 
+0

這實際上工作... :) – Tom 2013-04-10 12:14:48

+0

是的,但背景屬性縮放圖像。你需要明白這一點。 – jimpanzer 2013-04-10 12:25:02

1

嘗試使用FILL_PARENT代替match_parent除了在ListView的高度。在ListView的高度使用WRAP_CONTENT

1

集此scletype財產

android:scaleType=fitXY 

,並設置圖像的ImageView這樣

android:background="@drawable/myheader_250x60"