我有一個LinearLayout(水平),我正在使用它來顯示3個ImageViews。當我第一次添加ImageView時,最後一張縮小了,因爲圖像太大而不適合3。這裏是我的設計師屏幕看起來像:我的圖像上的額外填充
通知第三圖像收縮。
要解決此問題,我在每個ImageView上設置了以下屬性。
width: 0dp
weight: 1
這裏是我的圖片怎麼看設置這些屬性後:
我運行到的是,即使畫面已經縮水問題仍然存在空間在頂部和底部如以下圖像中的藍色矩形所示:
我的問題是,爲什麼這個額外填充那裏,我怎麼能擺脫它?
謝謝
更新 - 加入我的佈局文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:background="@color/app_background_color"
android:contentDescription="@string/game_image_button"
android:gravity="center"
tools:context=".EasyActivity" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/ImageView02"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/game_image_button"
android:src="@drawable/ruler200x200" />
<ImageView
android:id="@+id/ImageView01"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/game_image_button"
android:src="@drawable/ruler200x200" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="@string/game_image_button"
android:src="@drawable/ruler200x200" />
</LinearLayout>
</RelativeLayout>
只是好奇,什麼尺寸是你原來的形象?我的意思是它是一個'x乘x'的方形圖像? – 2013-03-16 22:34:46
它是200x200像素,它位於drawable_hdpi – 2013-03-16 22:36:58
如果您發佈整個佈局的代碼將更容易理解 – lelloman 2013-03-16 22:45:09