2011-02-17 31 views
1

我使用這個Layout將兩個ImageView放在一個接一個旁邊,但這兩個圖像似乎被1個透明像素空間分開。
藍色的背景是在那裏能夠更方便地觀察問題...

兩個ImageView之間的多餘空間android

<?xml version="1.0" encoding="UTF-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#0000FF"> 
    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:layout_marginTop="5dip"> 
     <ImageView 
      android:src="@drawable/i_position_icon" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"/> 
     <ImageView 
      android:src="@drawable/i_position_seekbar" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"/> 
    </LinearLayout> 
</LinearLayout> 

的是名爲.java:

public class MainActivity extends Activity { 

    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle icicle) { 
     super.onCreate(icicle); 
     requestWindowFeature(Window.FEATURE_NO_TITLE); 
     getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
     setContentView(R.layout.main); 

    } 
} 


進出口使用的設備與Android 2.2。
我不能在2.1模擬器上重現2.1-update1仿真器上的毛刺...
我檢查過圖像,並且沒有額外的像素。
另外我試圖在圖像上分別添加一個紅色的1px寬邊框,毛刺仍然存在,所以圖像似乎不是問題。

這是有問題的圖像(這裏顯示正確):
Image AImage B http://dl.dropbox.com/u/7024937/i_position_icon.png
http://dl.dropbox.com/u/7024937/i_position_seekbar.png


這是我在我的設備看到:
Transparent pixel between ImageViews

感謝。

+0

請讓我們知道您的SDK版本。 – 2011-02-17 10:10:43

+0

Im使用Android 2.2的設備。我無法在2.1模擬器上重現2.1-update1仿真器上的故障。 – Gero 2011-02-17 10:20:46

回答

0

聽起來很奇怪,因爲我在我的項目中使用了相同的技術,一切似乎都沒有問題。你把你的drawable放入正確的drawable文件夾中。我的意思是如果你的設備有hdpi屏幕,你應該把你的圖像放在drawable-hdpi文件夾中。對不起,但這是我想到的唯一想法。

0

奇怪,您定位的是哪個版本的SDK?我複製了你的佈局和代碼,並用api level 3(1.5)創建了一個新項目,並在1.5和2.2模擬器上進行了測試。在它沒有任何間距的罰款工作。

+0

Im使用Android 2.2的設備。就你而言,我無法在1.6模擬器上重現2.1-update1仿真器上的故障。 – Gero 2011-02-17 10:19:57