Mono for Andrid学习笔记(八)—— 如IPhone拖动相片特效,Gallery画廊.docx

Mono for Andrid学习笔记(八)—— 如IPhone拖动相片特效,Gallery画廊.docx

Mono for Andrid学习笔记(八)—— 如IPhone拖动相片特效,Gallery画廊

曾经被IPhone用手指在屏幕上滑来滑去拖动图片的操作方式吸引吗?在Android里,这并不是什么难事,只要用到Gallery即可。它通常用在设计相册、图片类型的选择器上。在开始之前,先了解一下什么是Context以及Android.Widget命名空间下的BaseAdapter,在Activity当中,Context就如同是Canvas画布,随时等着被处理或覆盖。还记得先前介绍Activity之间的传递时,做过Intent以及Context的应用吗?当中Intent是Android.Content命名空间下的一个类,而Context也是一样。本范例在Layout里布局一个Gallery对象,再通过BaseAdapter容器存放Gallery所需要的图片。先将你要显示的图片放到Drawable文件夹下,然后编译一下工程,使其能在代码中使用。Main.axml的结构很简单,只要放上一个Gallery即可:+ expand sourcexmlversion=1.0encoding=utf-8? LinearLayoutxmlns:android=/apk/res/androidandroid:orientation=verticalandroid:layout_width=fill_parentandroid:layout_height=fill_parent Ga

文档评论(0)

1亿VIP精品文档

相关文档