介绍一个Cursor的Gallery

/** Copyright (C) 2007 The Android Open Source Project** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package com.example.android.apis.view;import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.provider.Contacts.People;
import android.os.Bundle;
import android.widget.Gallery;
import android.widget.SimpleCursorAdapter;
import android.widget.SpinnerAdapter;// Need the following import to get access to the app resources, since this
// class is in a sub-package.
import com.example.android.apis.R;public class Gallery2 extends Activity {@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.gallery_2);// Get a cursor with all peopleCursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null);startManagingCursor(c);SpinnerAdapter adapter = new SimpleCursorAdapter(this,// Use a template that displays a text viewandroid.R.layout.simple_gallery_item,// Give the cursor to the list adatperc,// Map the NAME column in the people database to...new String[] {People.NAME},// The "text1" view defined in the XML templatenew int[] { android.R.id.text1 });Gallery g = (Gallery) findViewById(R.id.gallery);g.setAdapter(adapter);}}

2901-View-Gallery相关推荐

  1. 第二十四章:页面导航(六)

    制作导航菜单 如果您的应用程序包含各种不同但在架构上相同的页面,所有这些页面都可以从主页导航,那么您可能有兴趣构建有时称为导航菜单的页面. 这是一个菜单,其中每个条目都是特定的页面类型. ViewGa ...

  2. android 网络加载图片点击大图后 浏览 可 缩放,Android 网络加载图片点击大图后 浏览 可 缩放...

    找了一些demo感觉没有自己想要的效果,于是借鉴一些改造一下并记录下来: 1.主Activity public class PictureViewFra extends Activity { priv ...

  3. SAP UI5 sap.ui.vk 命名空间内的控件介绍

    SAP 电商云 Spartacus UI 里的 spare part 3D 模型展示,使用的控件来自 SAP UI5 sap.ui.vk 下的控件. sap.ui.vk 库为应用程序中 2D 和 3D ...

  4. 第二十四章:页面导航(六) 1

    制作导航菜单 如果您的应用程序包含各种不同但在架构上相同的页面,所有这些页面都可以从主页导航,那么您可能有兴趣构建有时称为导航菜单的页面. 这是一个菜单,其中每个条目都是特定的页面类型. ViewGa ...

  5. Magento2.1x常见报错处理

    这里写自定义目录标题 Object DOMDocument should be created Service Temporarily Unavailable 503 Registry already ...

  6. shopex各文件路径

    模板文件路径: / core / shop / view / gallery / 商品列表页 和 品牌列表页 / core / shop / view /brand/品牌首页 / core / sho ...

  7. 控件(View)之TextSwitcher, Gallery, ImageSwitcher, GridView, ListView, ExpandableList【转】

    在 Android 中使用各种控件(View) TextSwitcher - 文字转换器控件(改变文字时增加一些动画效果) Gallery - 缩略图浏览器控件 ImageSwitcher - 图片转 ...

  8. android 按住拖动gallery防止马上加载数据导致gallery卡的方法

    gallery菜单滑动有一个不好的效果就是每次经过中间的菜单都默认是被选中状态,同时会加载数据 以至于切换不流畅,有一种卡卡的感觉!!其实用线程来处理这个问题,一定的时间后如果选择的index值不变, ...

  9. 第四篇 Gallery控件

    直奔主题~! 结构如图: main.xml代码: <?xml version="1.0" encoding="utf-8"?> <Linear ...

  10. [android] 从gallery获取图片

    效果就是点击按钮,打开系统图库应用,可以选择一张里面的图片展示出来 设置隐式意图 获取Intent对象,通过new出来 调用Intent对象的setAction()方法,设置动作,参数:Intent. ...

最新文章

  1. 阿里Java编程规约(控制语句)
  2. markdown与latex:像小学生一样写乘X号\times
  3. 君が呼ぶ メギドの丘で 美吉特之丘的呼唤 游戏感想
  4. Spring Mvc前台访问报404
  5. Java集合---概述(1)
  6. Java坦克大战Summary
  7. 【python】一键修改小米运动步数,同步微信、支付宝 运动步数
  8. 最新行政区划代码下载
  9. (附源码)springboot物联网智能管理平台 毕业设计 2111120
  10. Oracle什么情况使用omf,ORACLE OMF介绍
  11. 阿里云CentOS7.2清除wnTKYg木马
  12. OpenCV學習筆記(6)基於 VC+OpenCV+DirectShow 的多個攝像頭同步工作
  13. 车联网-App车况展示数据设计思路
  14. 智能算法系列之粒子群优化算法
  15. Linux安装mysql没有my.cnf文件
  16. JSP校园运动会管理系统
  17. 苹果主题商店_盒子电视模拟器电视直播+影视点播!苹果安卓手机影视点播!...
  18. 【飞行器】模拟四旋翼飞行器飞行含Matlab源码
  19. python人脸识别代码_Python不用10行代码就可实现人脸识别,还可辨别真假,太棒了!...
  20. java web 开发之道_《Java Web开发之道》PDF 下载

热门文章

  1. postgresql的pg_wal日志
  2. python语言程序设计网课答案-真不错!大学慕课Python语言程序设计章节测试答案...
  3. aistarter助手程序未运行_出现aistarter助手程序不在执行状态中
  4. python快速实现简易双重弹力球小游戏
  5. jquery在线引用网址
  6. Flex LCDS 与 spring 框架的整合说明
  7. Ganymed ssh小使用
  8. Windows11 21H2的版本任务栏任务折叠小窗口不是圆边的,很丑!
  9. 精益创业的理论和案例分析
  10. 从人脸识别到行人重识别,下一个风口