2

我想向用户显示手机上的图像。但我想向用户展示图像的预览。

在此处输入图像描述

当用户触摸图像时,我想显示图像的路径。

我的布局中有一个按钮。单击按钮时如何显示图像。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/back_default">

    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/button_pickimage" android:id="@+id/btn_pickimage"></Button>

</LinearLayout>
4

3 回答 3

2

http://developer.android.com/resources/tutorials/views/hello-gallery.html

这应该提供一个很好的起点

于 2012-05-17T09:05:39.997 回答
0

我认为你应该看看 Android GalleryAndroid GridView

当您单击按钮时,只需将 Intent 定向到 GridView。

关于单击图像以显示其路径是另一回事。您可以构建自定义布局或 Toast 或其他任何内容来满足您显示路径的需要。将 onClick 侦听器放在 Image 上以执行此操作。

于 2012-05-17T09:03:50.190 回答
0

据我了解,您想首先显示缩略图(如链接中所示),然后单击任何图像应在不同视图中放大该特定图像,

然后简单的方法..

1.Make two separate activity for preview and large image
2. Store all your image in a array(If you have diff images for preview and large image then place accordingly).
3. set id for each imageview (In preview mode)
4. send id of selected imageview to next activity using putextra
5. Use id to access the array
于 2012-05-17T09:24:14.743 回答