1

データベースから画像をロードしlistviewていますが、フローティング ウィンドウを作成したいと考えています。それらの 1 つがクリックされると、フローティング ウィンドウの写真が添付されます。

リストからイベントを処理する方法は知ってonClickいますが、アクティビティ レイアウトを正しく作成する方法が見つかりません

そして、これが私がこれまでに思いついたものです-

<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/image_dialog_root"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:paddingLeft="5dp"
    android:paddingRight="5dp" >

    <ImageView
        android:id="@+id/your_image"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="centerInside"
        android:src="@drawable/ab" />

    <TextView
        android:id="@+id/image_desc"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/background_light" />

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/open_in_other_app"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_marginRight="5dp"
            android:text="button1" />

        <Button
            android:id="@+id/close_image_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_marginLeft="5dp"
            android:text="button2" >
        </Button>
    </RelativeLayout>

</FrameLayout>
4

1 に答える 1

2

@twnteeのアドバイスといくつかの検索により、私の問題を解決するこの記事にたどり着きました- http://www.mkyong.com/android/android-custom-dialog-example/

于 2013-09-03T22:06:11.733 に答える