ListView Android中的列

如何在 Android ListView中创建列?我有这个列表项布局xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="horizontal">
    <TextView android:layout_weight=".3" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/hour"
        android:gravity="center" />
    <ImageView android:id="@+id/symbol" android:scaleType="fitCenter"
        android:layout_gravity="center_horizontal" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_weight=".5" />
    <TextView android:layout_weight=".8" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/temperature"
        android:gravity="center" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/percipitation"
        android:gravity="center" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/wind_speed"
        android:gravity="center" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/wind_direction"
        android:gravity="center" />
</LinearLayout>

问题是f.ex. wind_direction从“4”变为“300”,然后列不对齐.

The problem http://img185.imageshack.us/img185/2812/deviceo.png

谁可以用固定宽度的列制作并使用与设备无关的整个宽度?

解决方法

考虑使用TableLayout而不是ListView.这被设计为具有行和列.见 Hello TableLayout.

要以编程方式添加行,可以使TableRow膨胀并在TableLayout上调用addView.

相关文章

这篇“android轻量级无侵入式管理数据库自动升级组件怎么实现...
今天小编给大家分享一下Android实现自定义圆形进度条的常用方...
这篇文章主要讲解了“Android如何解决字符对齐问题”,文中的...
这篇文章主要介绍“Android岛屿数量算法怎么使用”的相关知识...
本篇内容主要讲解“Android如何开发MQTT协议的模型及通信”,...
本文小编为大家详细介绍“Android数据压缩的方法是什么”,内...