我有這個代碼,需要以下位置的圖像。但是,因爲我使用了相對佈局,&圖像沒有在所有設備中正確對齊,有些圖像重疊。 編輯:主要要求:在我的要求中,我想點擊綠色帽子。所以,如果我按下紅色帽子,該ImageView將會消失。因此,剩下的兩個圖像必須位於同一個位置。因此,如果我使用layout_weight,它將剩餘的兩個圖像覆蓋到剩餘的空間。 我怎樣才能得到這個要求的最佳輸出。在佈局上顯示圖像
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#657383"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:contentDescription="@string/app_name" />
<ImageView
android:id="@+id/imageView2"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:contentDescription="@string/app_name" />
<ImageView
android:id="@+id/imageView3"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:contentDescription="@string/app_name" />
謝謝。
水平LinearLayour與layout_widht =「0dip」。 +1 – Blackbelt 2013-05-08 07:22:19
請檢查編輯後的問題。 – sai 2013-05-08 07:43:47
只需使用android:visibility =「gone」,當你需要使其不可見時 – stinepike 2013-05-08 08:16:36