我有一個FrameLayout包含2個視圖,第二個像Close Button (X)
,我想把它放在右邊。如何將一個元素與FrameLayout中的右邊對齊?
我試過layout_gravity =「right」,但沒有奏效。
這是我的佈局XML:
<FrameLayout android:layout_width="320dp"
android:layout_height="wrap_content"
android:id="@+id/layoutSmallImg">
<ImageView android:id="@+id/bigImage"
android:layout_width="320dp" android:layout_height="wrap_content"/>
<ImageView android:id="@+id/bigImage"
android:layout_width="320dp" android:layout_height="wrap_content"/>
<ImageButton android:id="@+id/closebutton"
android:background="@android:color/transparent"
android:layout_height="30dp" android:layout_marginTop="10dp"
android:layout_alignParentRight="true"
android:layout_width="30dp" android:paddingLeft="40dp"
android:visibility="gone"
android:src="@drawable/close" />
</FrameLayout>
謝謝您的回答,我知道這是可能的RelativeLayout的,我想對齊在FrameLayout裏,:( 是的,我想在頂部的ImageButton | ImageView的權利,它會看起來像的關閉按鈕我圖像,當我點擊,圖像將淡出 – Houcine 2011-05-19 15:14:31
爲什麼?(10個字符) – Aleadam 2011-05-19 15:16:26
看我的編輯評論 – Houcine 2011-05-19 15:20:28