返回

可循环显示图像的Android Gallery组件实现循环显示图像的Gallery

时间:2017年01月05日 04:51评论:0
第 4 页 实现循环显示图像的Gallery组件
实现循环显示图像的Gallery组件


<!--[endif]-->
在本节将组出与循环显示图像相关的ImageAdapter类的完整代码。读者可以从中看到上一节介绍的两点改进。为了使界面看上去更丰满,本例还在单击某一个Gallery组件中的图像时在下方显示一个放大的图像(使用ImageSwitcher组件)。本例的显示效果如图3所示。当不断向后移动图像时,图像可不断显示,读者可以自己运行本例来体验一下。

 
<!--[endif]-->
在main.xml文件中定义的Gallery和ImageSwitcher组件的代码如下:


代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Gallery android:id="@+id/gallery" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_marginTop="30dp" />
    <ImageSwitcher android:id="@+id/imageswitcher"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_marginTop="30dp" />
</LinearLayout>

本文导航

上一页 1 2 3 4 5 6 下一页
相关文章
猜你喜欢
用户评论