多列ListView的机器人 [英] Multicolumn ListView Android

查看:102
本文介绍了多列ListView的机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个排行榜,排行榜单我的应用程序。我想显示在4列中的数据,排名,名称,创建者,分数和对象的列表相应的填充它们。我想显示5个项目同时在名单上,共有20个项目上榜滚动的名单上。我无法找到一个合适的方式去这一点。这将是巨大的,如果我能在'如何',因为我的工作的最后期限将至的快速指南。

i am creating a leaderboard, highscore list for my application. I want to display the data in 4 columns, Rank, Name, Creator, Score and populate them accordingly by a list of objects. I want to display 5 items at once on the list with a total of 20 items on the list making the list scrollable. I cannot find a suitable way to go this. It would be great if i can get a quick guide on 'how to' since the deadline of my work is approaching.

万分感谢:)

推荐答案

您可以轻松定义自定义的ListView做到了。

You can easily done it with defining Custom ListView.

有关定义自定义列表视图,只需定义一个自定义行布局文件与水平的方式4的TextView。现在充气列表视图的自定义适配器这里面的布局文件,你需要重写getView()方法,并夸大该行布局文件。

For defining custom listview, just define a custom row layout file with 4 textview in horizontal manner. Now inflating this layout file inside the custom adapter of listview, for that you need to override getView() method and inflate that row layout file.

更新: 只需选中此教程定义自定义列表视图,但要一定要通过定义一个自定义行布局文件与4水平的TextView使用本教程。

Update: Just check this tutorial to define custom listview, but make sure you use this tutorial by defining a custom row layout file with 4 horizontal textview.

下面是 row_layout.xml 文件:

<LinearLayout 
    android:id="@+id/relativeLayout1" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <TextView
        android:id="@+id/FirstText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="First"
        android:layout_weight="1">
    </TextView>

    <TextView
        android:id="@+id/SecondText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="Second"
        android:layout_weight="1">
    </TextView>

    <TextView
        android:id="@+id/ThirdText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="Third"
        android:layout_weight="1">
    </TextView>

    <TextView
        android:id="@+id/FourthText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="Fourth"
        android:layout_weight="1">
    </TextView>
</LinearLayout>

这篇关于多列ListView的机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆