這是佈局我有:產生看起來像這樣的列表項安卓:如何強制左對齊項目來包裝,而不是右對齊項目?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:minHeight="?android:attr/listPreferredItemHeight">
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<TextView
android:id="@+id/customer_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:paddingLeft="4dip"/>
<TextView
android:id="@+id/ticket_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:paddingLeft="6dip"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="right">
<TextView
android:id="@+id/total"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:paddingRight="6dip"/>
<TextView
android:id="@+id/date"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:paddingRight="6dip"/>
</LinearLayout>
</LinearLayout>
:
,正如你所看到的,這是一個有點難看。我想對包裝頂部的藍色框,如果右上方盒爲紅色,並有底部行完全獨立的理由往上頂的,這樣的日子不換行可言,無論什麼樣的頂行的樣子。什麼是完成這一任務的最好方法是什麼?
感謝。我已經張貼在一個單獨的回答這個問題的實現,但接受了你的是正確的。 – moonlightcheese 2012-02-01 21:46:16