I'm noticing that by adding the HorizontalScrollView
it's disabling my ability to select items on my ListView
. This seems like a pretty basic/common feature to want to add (I want to be able to swipe my item to the left to offer a delete option) but HorizontalScrollView
appears to be incompatible with items that you would like to also touch to select. Note that if I change HorizontalScrollView
to a LinearLayout
or otherwise the items become selectable.
I was suspecting that touch listeners
may be ineffective due to the fact that the swiping capability overrides
any other kind of touch, but I can't really think of why it doesn't work otherwise. Can anyone help to resolve this issue? I would like to be able to use HorizontalScrollView
alongside a click compatibility
(unless there is another way to achieve the same functionality).
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.constraint.ConstraintLayout
android:id="@+id/constraintLayout4"
android:layout_width="384dp"
android:layout_height="110dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/task_view_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="17dp"
android:layout_marginTop="28dp"
android:fontFamily="@font/robotolight"
android:text="@string/task_name"
android:textColor="@android:color/black"
android:textSize="24sp"
app:layout_constraintStart_toEndOf="@+id/task_view_icon"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/task_view_icon"
android:layout_width="77dp"
android:layout_height="77dp"
android:layout_marginStart="17dp"
android:layout_marginTop="17dp"
android:contentDescription="@+string/icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/main_page_icon_switch_x4" />
<TextView
android:id="@+id/task_view_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginTop="36dp"
android:fontFamily="@font/robotolight"
android:text="@string/duration"
android:textColor="@android:color/black"
android:textSize="14sp"
app:layout_constraintStart_toEndOf="@+id/task_view_name"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/task_view_detail"
android:layout_width="228dp"
android:layout_height="31dp"
android:layout_marginStart="17dp"
android:fontFamily="@font/robotolight"
android:text="@string/task_view_detail_literal"
android:textColor="@android:color/black"
android:textSize="12sp"
app:layout_constraintStart_toEndOf="@+id/task_view_icon"
app:layout_constraintTop_toBottomOf="@+id/task_view_name" />
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:id="@+id/task_delete"
android:layout_width="116dp"
android:layout_height="110dp"
android:background="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="@id/constraintLayout4"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/task_delete_literal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="13dp"
android:layout_marginTop="39dp"
android:fontFamily="@font/roboto_regular"
android:text="@string/delete"
android:textColor="@android:color/background_light"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</HorizontalScrollView>