Android RelativeLayout over ListView,当RealtiveLayout显示为时未检测到onclick
我当前是一个Android RelativeLayout over ListView,当RealtiveLayout显示为时未检测到onclick,android,android-listview,android-relativelayout,android-tabhost,android-framelayout,Android,Android Listview,Android Relativelayout,Android Tabhost,Android Framelayout,我当前是一个相对布局显示在列表视图中。结果表明,当我单击RelativeLayout时,总是在列表视图中捕捉到单击事件 我想在显示布局时检测其上的手势,但当我单击时,该项目将从下方的列表视图中选择 有人知道这个问题的解决办法吗 <TabHost android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" andr
相对布局
显示在列表视图中
。结果表明,当我单击RelativeLayout
时,总是在列表视图中捕捉到单击事件
我想在显示布局时检测其上的手势,但当我单击时,该项目将从下方的列表视图中选择
有人知道这个问题的解决办法吗
<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>
已将listview插入到:
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="0dp" />
如果您使用的是手势检测器
请尝试调用mDetector.setIsLongpressEnabled(true)代码>第一个,并通过convertView.setLongClickable(true)设置视图长可点击代码>当我在与listview不重叠的区域中做手势时,手势被正确检测到。但手势必须在与listview重叠的RelativeLayout中进行,当我单击任何重叠的区域时,listview始终是检测到的元素…尝试将GestureDetector
应用到下面的布局listview
和RelativeLayout
。例如,您可以使用findviewbyd(android.R.id.content)代码>