适配器列表视图的自定义布局 [英] Adapter for a custom layout of listview

查看:167
本文介绍了适配器列表视图的自定义布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android项目中,我必须从组字符串数组(比如标题,描述,ID)的列表视图项的TextView加载。

I am developing an android project in which I have to load from group of String arrays(say title,description,id) to the listview item TextView.

我没有使用光标这样的数据库,类似的事情

I did something similar with a database using a cursor like this

String[] from = new String[]{"medicine","healthsystem"};
            int[] to = new int[] {R.id.textlist1,R.id.textlist2};
             // Now creating an array adapter and set it to display using my row
            SimpleCursorAdapter notes =new SimpleCursorAdapter(this,R.layout.notes_row, c, from, to);

我列出的所有在从的目标和所有的原点到。 现在我的问题是我没有一个数据库,所以不能使用游标。

I listed all the targets in "from" and all the origin in "to". Now my problem is I don't have a database so cant use a cursor.

我有一个字符串数组3,我要加载到每个项目

I have 3 arrays of strings which i want to load into textviews(title,description,id) of each item

如何做到这一点 请您帮我出 谢谢:)

How to do this Please kindly help me out thank you :)

推荐答案

如果你没有光标,为什么你使用的是SimpleCursorAdapter?

If you don't have a cursor, why are you using a SimpleCursorAdapter?

阅读这篇文章,有关创建使用SimpleAdapter一个 SimpleListView 的备用想法。

Read this article about creating a SimpleListView using SimpleAdapter for alternate ideas.

这篇关于适配器列表视图的自定义布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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