我在水平線性佈局中有2個圖像。我想要一個坐在左邊,另一個坐在最右邊。像這樣如何使用LinearLayout將兩個圖像放在相反兩端?
X ---------------------------- X
這裏是我的XML
<LinearLayout
android:id="@+id/headerBarLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/batteryImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/battery" android:layout_weight="0"/>
<ImageView
android:id="@+id/exit_button"
style="@style/MotionMetrics.ExitButton"
android:src="@drawable/exit_button" android:layout_width="wrap_content"/>
</LinearLayout>
不知道他們爲什麼不在相反的一端。
照片:
謝謝,我試過了。差不多了。看看我剛添加的截圖。圖像並不完全正確。 –
更新了我的回覆。試試看。 –
和以前一樣的結果,我也刪除了它的風格。除了現在的水平高度沒有差異 –