在android中显示来自SQLite数据库的数据 [英] Display data from SQLite database in android

查看:117
本文介绍了在android中显示来自SQLite数据库的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android的新手,所以我很抱歉,如果这似乎是一个愚蠢的问题。我想显示从SQLite数据库返回的数据。所有这些数据都是文本,我很困惑,如果我使用GridView或ListView来显示这些数据。列将在5左右,所以,直到现在我觉得我需要使用GridView。如果有人能用一个简单的例子告诉我使用哪一个,我将非常感激。

提前谢谢。

I am a newbie in android so my apologies if this seems to be a silly question. I want to display data returned from the SQLite database. All of this data is text and I am confused should I use GridView or ListView to display this data. Columns would be around 5 so, until now I feel that I need to use GridView. I shall be very thankful if someone can tell me which one to use with a simple example.
Thanks in advance.

推荐答案

它会当然取决于价值的长度。就个人而言,我会为具有很长文本的数据选择ListView。在ListView上仅显示重要标识符(例如,名称或ID),然后在用户按下列表项时显示详细信息(其他列的值)。至于示例,有很多教程。其中一些在下面。



ListView

http://developer.android.com/guide/topics/ui/layout/listview.html [ ^ ]

http://www.vogella.com/articles/AndroidListView/article.html [ ^ ]

http://www.learn2crack.com/2013/10/android-custom-listview-images-text-example.html [< a href =http://www.learn2crack.com/2013/10/android-custom-listview-images-text-example.htmltarget =_ blanktitle =New Window> ^ ]



GridView

http://developer.android.com/guide/topics/ui/layout/gridview.html [ ^ ]

http://www.androidhive.info/2012/02/android-gridview-layout-tutorial/ [ ^ ]
It will of course depend on the length of the values. Personally, I would choose ListView for data that has a quite long text. Show only the important identifier (Name or ID for example)on your ListView and then show the details (values of the other columns) when the user has pressed the list item. As for examples, there are many tutorials out there. Some of them are below.

ListView
http://developer.android.com/guide/topics/ui/layout/listview.html[^]
http://www.vogella.com/articles/AndroidListView/article.html[^]
http://www.learn2crack.com/2013/10/android-custom-listview-images-text-example.html[^]

GridView
http://developer.android.com/guide/topics/ui/layout/gridview.html[^]
http://www.androidhive.info/2012/02/android-gridview-layout-tutorial/[^]


这篇关于在android中显示来自SQLite数据库的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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