2012-01-17 22 views
0

我在兩個不同的ImageView中使用了兩個圖像,而在LinearLayout和垂直方向中使用了Layout。 現在我想觸摸Frist圖像邊界(底部)到其他圖像的頂部。但在android默認情況下,它們之間有一定的空間。Android:圖像視圖中的兩個圖像必須互相接觸

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:src="@drawable/ic_launcher" /> 
<ImageView 
    android:id="@+id/imageView2" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:src="@drawable/ic_launcher" /> 

我希望這些圖像互相觸碰。謝謝

回答

1

嘗試

android:layout_marginTop="-12dip" 

在你的第二個ImageView的 和12dip更改爲自己NUM,發現它是負的NUM。

第二種方式,使用RelativeLayout可以滿足你。

+1

另一種選擇是擺脫填充而不是邊距。填充設置爲0px可能更易於閱讀。 :) – 2012-01-17 09:24:34

0

將android:padding設置爲「0dp」,android:layout_marginTop/Bottom設置爲「0dp」。那麼他們應該沒有理由不接觸。

此外,請確保您的資源(png/jpg/etc)在邊緣周圍沒有額外的透明度,因爲這會計入圖片。

相關問題