列表视图问题
我在列表视图中遇到问题..我想将不同的字段放在同一个列表视图中这可能吗?
像这样?
DBAdapter db = new DBAdapter(.this);
db.open();
List<String> ct = new ArrayList<String>();
ct = db.getAllAccounts();
List<String> sd = new ArrayList<String>();
sd = db.getAllAmount();
Account = (ListView) findViewById(R.id.ListView_addAccount);
Account.setAdapter(new ArrayAdapter<String>(this,R.layout.list_contas_layout,R.id.text1,R.id.text2, ct,sd));
有这样的东西可以用吗? 对不起我的英语;)
i have a problem in a list view.. i want to put different fields in the same listview is this possible?
like this?
DBAdapter db = new DBAdapter(.this);
db.open();
List<String> ct = new ArrayList<String>();
ct = db.getAllAccounts();
List<String> sd = new ArrayList<String>();
sd = db.getAllAmount();
Account = (ListView) findViewById(R.id.ListView_addAccount);
Account.setAdapter(new ArrayAdapter<String>(this,R.layout.list_contas_layout,R.id.text1,R.id.text2, ct,sd));
theres something like this to use?
sorry about my english;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
绝对地。看一下
SimpleCursorAdapter
。我不确定您正在使用什么数据库,但是使用Cursor
类对于此类事情来说是很正常的。否则,您将必须创建自己的自定义适配器。Absolutely. Take a look at
SimpleCursorAdapter
. I'm not sure what database you're using, but using theCursor
class is pretty normal for this sort of thing. Otherwise you're going to have to create your own custom adapter.