0
我有一个显示项目列表的页面。列表中的每一行都有三列,出于某种原因,列表中的项目没有正确对齐。 下面是我的代码:Android:CustomListAdapter列未正确对齐
自定义适配器:
<TextView
android:id="@+id/tvCategoryName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:layout_weight="0.90"
android:textAlignment="textStart"/>
<TextView
android:id="@+id/tvWeight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Weight"
android:layout_weight="0.05"
android:textAlignment="center"/>
<TextView
android:id="@+id/tvAverage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Average"
android:layout_weight="0.05"
android:textAlignment="center"/>
</LinearLayout>
我想Categories
,Weight
和Average
所有三列是以与centered
文本对齐的格式显示在一个漂亮的表格中。
当“类别名称”太长或太短时,仍不起作用 –
是的,如果您使用的是layout_weight,则应该将layout_width设置为0dp –
工作正常!非常感谢你 :) –