0

私は現在、relative layoutに表示されていlistviewます。クリックするとRelativeLayout、常にクリックイベントがキャッチされますlist view

レイアウトが表示されているときにジェスチャを検出したかったのですが、クリックすると、listviewその下にあるアイテムからアイテムが選択されます。

誰かがこの問題の解決策を知っていますか?

<TabHost
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/start_tabs_topbar" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="0dp" >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:padding="0dp" />

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="-4dp"
            android:layout_weight="0" />
    </LinearLayout>
</TabHost>

    <RelativeLayout
        android:id="@+id/playertab1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/back_artista"
        android:gravity="center_vertical|left"
        android:paddingLeft="15dp" >

        <LinearLayout
            android:id="@+id/music_info"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity=""
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/artist_image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="9dp"
                android:layout_marginTop="4dp"
                android:src="@drawable/placeholder" />

            <LinearLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="top"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/playlist_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="playlist_name"
                    android:textColor="#3BBEF9"
                    android:textSize="15dp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/artist_album"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="artist_album"
                    android:textColor="#EEEEEE"
                    android:textSize="11dp" />

                <TextView
                    android:id="@+id/artist_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="artist_album"
                    android:textColor="#EEEEEE"
                    android:textSize="11dp" />

                <TextView
                    android:id="@+id/artist_song"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="artist_song"
                    android:textColor="#EEEEEE"
                    android:textSize="11dp" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>

挿入されたリストビュー:

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:padding="0dp" />
4

1 に答える 1

1

使用している場合は、最初にGestureDetector呼び出しmDetector.setIsLongpressEnabled(true);て、ビューをロングクリック可能に設定してみてくださいconvertView.setLongClickable(true);

于 2012-06-18T10:23:33.610 に答える