本例使用SimpleCursorAdapter 作为Gallery控件的数据源。 SimpleCursorAdapter 从设备通讯录读取联系人 ,Cursor用法可以参见
Android ApiDemos示例解析(10):App->Activity->QuickContactsDemo 和
Android ApiDemos示例解析(113):Views->Expandable Lists->2. Cursor(People)
SimpleCursorAdapter 的构造函数如下
public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to)
- context: context对象,可以使用activity。
- layout: layout 资源ID
simple_gallery_item.xml
- cursor: cursor对象,本例为通讯录cursor.
- from: 需要显示的列名数组
- to: 列对应的View 的id
SpinnerAdapter adapter = new SimpleCursorAdapter(this,
// Use a template that displays a text view
android.R.layout.simple_gallery_item,
// Give the cursor to the list adatper
c,
// Map the NAME column in the people database to...
new String[] {People.NAME},
// The "text1" view defined in the XML template
new int[] { android.R.id.text1 });
Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(adapter);
本例Adapter 使用的View为TextView (id 为 android.R.id.text1) ,因此 Gallery显示的为联系人的人名。
分享到:
相关推荐
NULL 博文链接:https://kakukemeit.iteye.com/blog/1806388
android apidemos代码的示例解析,讲的挺全的
Android ApiDemos apk, 包括Android presentation双屏异显 demon, App>Activity>Presentation
最新版ApiDemos Android SDK 中带有很多例子,其中ApiDemo 详细介绍了Android 平台主要API,分成了 · App · Content · Graphics · Media · OS · Text · Views 几个大类,每个大类又分为几个小类,...
从官方预览包里提取的Android6.0 ApiDemos.apk,方便安装在真机上查看实例的实际效果。
demos :jdk-8u202-linux-x64-demos.tar.gz
最新Android apidemos
demos :jdk-8u202-linux-arm64-vfp-hflt-demos.tar.gz
Run demos in Assets/FairyGUI/Examples/Scenes. The UI project is in Examples-UIProject.zip, unzip it anywhere. Use FairyGUI Editor to open it. Using FairyGUI in Unity: * Place a UIPanel in scene by ...
API Demos 是 Google 为了 Android 开发者所提供的一个 Android API 合集,其中包含了很多的 API 范例,同时遵循了良好的代码规范,是一个值得开发者研究和学习的典型。android的ApiDemos,需要解压缩后使用。
android APIdemos,android 源码简单使用demos
Microsoft.Premium.DP-300.by_.VCEup_.82q-DEMOS.pdf
Android 5.1的ApiDemos安装包
文件名称: jdk-8u231-solaris-x64-demos.tar.gz 文件大小: 8.43 MB (8,846,115 字节) MD5: 3b62803c4e86b40f1a83b68be7bce224 SHA1: 3aba5de2157163b949179a5b654494da05b4da9c SHA256: 774c5d41a1422d22d026eaaa39...
api ------------- API目录 demos ------------- 本地demos目录 lib ------------- 框架源代码目录 index.htm ------------- 主页面 loading.gif ------------- loading图标 welcome.htm ------------- 欢迎页面 ...
r下载后,解压,把解压后的文件直接放入到red5webaaps下
该Api Demos 源码是基于Android6.0 ,Eclipse下的,可以直接使用Android studio 导入工程即可。
Android 系统原生应用API示例程序集合,是初学Android 开发的重要参考资料 https://github.com/longtaoge
jdk-7u40-windows-x64-demos.zip
demos :jdk-8u202-linux-arm32-vfp-hflt-demos.tar.gz