我真的在我的應用程序的佈局的一部分掙扎。我有一個帶有居中圖像的標題欄,右側應該有兩個按鈕(或者像我現在擁有的可點擊圖像)。我設法讓彼此旁邊的圖像(都居中),但我想要在右邊的圖像。當我使用layout_weight創建「第一個」拉伸時,按鈕位於右側,但它們非常小。我希望按鈕(圖像)保持其原始大小。我甚至試圖使用minWidth和minHeight對其進行硬編碼,但這不起作用。Android:酒吧與中心圖像和按鈕在右邊
這裏是中心所有代碼:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@drawable/header_tile">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/header_logo">
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/previous"
android:src="@drawable/omhoog"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageView>
<ImageView
android:id="@+id/next"
android:src="@drawable/omlaag"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageView>
</LinearLayout>
</LinearLayout>
這裏是這樣的作品,除了最後的圖像變得如此小的代碼:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@drawable/header_tile">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/header_logo"
android:layout_weight="2">
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/previous"
android:src="@drawable/omhoog"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageView>
<ImageView
android:id="@+id/next"
android:src="@drawable/omlaag"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageView>
</LinearLayout>
</LinearLayout>
任何想法?非常感謝!
埃裏克
工程很好,直到現在還不知道RelativeLayout。完善! – Erik 2010-09-03 09:25:51