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

私が理解しているように、最初にサムネイル画像を表示したいと考えており(リンクに示されているように)、いずれかの画像をクリックすると、その特定の画像が別のビューで拡大されます。

次に、簡単なアプローチ..

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 に答える
0

Android GalleryAndroid GridViewを見るべきだと思い ます

ボタンをクリックすると、Intent を GridView に向けるだけです。

また、画像をクリックしてそのパスを表示することについては、別のことです。パスを表示する必要に応じて、カスタム レイアウトやトーストなどを作成できます。これを行うには、イメージに onClick リスナーを配置します。

于 2012-05-17T09:03:50.190 に答える