所以我正在尝试创建一个看起来像这样的表:
shrimp: 12pc $10.99 24pc $18.99
scallops: 10pc $11.99 15pc $14.99
...等
但是我的代码第一列(例如shrimp
)的某些错误占用了大部分屏幕空间,而且计数和价格最终在屏幕右侧被压缩。
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_conent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Shrimp:" />
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="12pc - $10.99" />
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="24pc - $18.99" />
</TableRow>
有人能告诉我这里有什么问题吗?我尝试使用布局宽度和高度,但我可以让它看起来像我想要的唯一方法是,如果我在第一列的布局宽度中键入错误。它看起来像我想要的方式,但如果我这样做,我会收到编译器错误。
答案 0 :(得分:0)
由于layout_weight属性,请尝试将其删除,并在TextView之间添加一些空格。
然后它将是你需要的。