0

グリッドビューにウィンドウのようなポップアップを開くボタンを実装しようとしています。心の中にはこんなものがあります。

ここに画像の説明を入力

このようなものを生成する必要があります

ここに画像の説明を入力

これを使用するために追加するライブラリはありますか?

これは、これを実装しようとしているグリッドビューです

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="5dp"
    tools:context=".MainActivity" >

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

        <ImageView
            android:id="@+id/image_song"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:background="@drawable/etuneslogo"
            android:scaleType="fitXY"
            android:paddingLeft="3dp"
            android:paddingRight="3dp"
            android:adjustViewBounds="true"/>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_below="@+id/image_song">

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                />

        <TextView
        android:id="@+id/song_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="3dp"
        android:layout_marginRight="3dp"
        android:paddingLeft="2dp"
        android:paddingRight="2dp"
        android:textSize="14dp"
        android:background="@color/fmYellow"
        android:textColor="@color/gridViewText"
        android:fontFamily="sans-serif-medium"
        android:textStyle="bold" />

        <TextView
            android:id="@+id/artist_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/song_name"
            android:layout_marginLeft="3dp"
            android:layout_marginRight="3dp"
            android:paddingLeft="2dp"
            android:paddingRight="2dp"
            android:paddingBottom="4dp"
            android:background="@color/fmYellow"
            android:textSize="12dp"
            android:textColor="@color/gridViewText"
            android:fontFamily="sans-serif-light"
            android:textStyle="bold" />

        </RelativeLayout>

    </RelativeLayout>

</RelativeLayout>
4

1 に答える 1

1

あなたがやりたいことは、グリッドビューの各アイテムに AlertDialog を使用することだと思います。

これは 1 つのボタンにしか使用していませんが、各グリッドビュー アイテムにインテントを追加すると機能すると思います。

AlertDialog の使用方法の適切な説明を次に示します。

Android: 複数の選択オプションを持つポップアップを作成する

于 2015-08-24T23:22:25.467 に答える