一些XML佈局編碼所以我有問題......我應該複製此圖像XML Android的佈局問題
但到目前爲止,我似乎只能遠遠得到這個和結帳按鈕拒絕留下來的權利,即使當我做採用Android:重力=「正確的」浮動的容器內吧...:/
這是我到目前爲止的代碼:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".CartActivity" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:text="Shopping Cart"
android:background="@android:color/holo_blue_dark" />
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@android:color/holo_blue_light"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subtotal:" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#800000"
android:text="£???" />
<Button
android:id="@+id/checkout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Checkout" >
</Button>
</LinearLayout>
</LinearLayout>
你解決了這個問題? – Android
非常感謝,問題解決了:) 但是我並不需要android:weightSum =「3」,使用它實際上使它遍佈各處。然而,將android:layout_weight =「1」放入兩個文本視圖解決了該問題,因此結帳按鈕不需要重新對齊:) – user3207096