В элементе списка у меня есть две группы представлений с идентификаторами как и below
макетов. Когда отображается above
макет below
макет будет виден. Теперь, когда я нажимаю на макет below
, я не хочу, чтобы событие click происходило. Он не должен выделять вид.Отключить щелчок дочернего макета в элементе списка
Ниже приведен код макета,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants">
<!-- need to disable click event for this layout-->
<RelativeLayout
android:id="@+id/below
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:visibility="gone"
>
<include layout="@layout/options" />
</RelativeLayout>
<LinearLayout
android:id="@+id/above"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/view”
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/content” />
</LinearLayout>
Это не будет работать. Возврат false приведет к тому, что 'onTouch' продолжит спускаться по иерархии, чтобы найти слушателя. Вам нужно вернуть true. –
это не сработало @Paulo – quest
@LoyalRayne return true работает отлично, спасибо ... – quest