1
我正在嘗試製作具有以下佈局的餐館菜單。項目字段和說明字段下的價格等於該項目的右側。我已經嘗試了使用每個行的列表視圖和具有項目和說明設置爲2項目佈局的列表視圖的一切,但我保持其他列表視圖同步的問題。列表視圖與自定義列布局嵌套LinearLayouts
現在我嘗試了一個列表視圖佈局作爲我的主要佈局,並添加了一個水平線性佈局與文本視圖添加到它相同的權重。至於第一列應該有2個項目,我使用了一個verical線性佈局,並添加了文字視圖
我想要的是設置垂直線性佈局權重讓可以說3和其餘的項目爲1。並在垂直線性佈局內,我想設置文本視圖來填充寬度但不能超過其他其他列和高度翹曲的內容,因爲我加載項目的形式描述的數據庫,這是很多行。
我到目前爲止嘗試的是以下這僅僅是添加到列表佈局的行佈局。下面的圖片顯示了列表中的問題。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center"
android:orientation="horizontal"
android:paddingBottom="6dip"
android:paddingTop="4dip" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/text1_"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="TextView" />
<TextView
android:id="@+id/text2_"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="TextView" />
</LinearLayout>
<TextView android:id="@+id/FROM_CELL"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView android:id="@+id/TO_CELL"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:id="@+id/TRAIN_CELL"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
其固定在垂直線性佈局,但其他textviews仍然弄亂 – 2013-04-22 10:53:14
設定爲textviews最小和最大寬度在垂直線性佈局固定它爲答案 – 2013-04-22 10:59:19