Reputation: 124
I have a "setOnItemClickListener" for a custom listview that I made. When the row is clicked, a method runs. That works. I am able to get a link to be clickable in the textview from within the listview by using this...
android:autoLink="web"
But then the row becomes unclickable. Any row that does not have a link in it can be clicked. The autoLink is overriding the "setOnItemClickListener" for the listview. How do I overcome this problem?
Upvotes: 0
Views: 45
Reputation: 23881
ListView
with focusable elements disable the click event on the ListView
itself
To overcome it..
Add :
android:descendantFocusability="blocksDescendants"
to your listview row's root layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<TextView
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:focusable="false"
android:textSize="15sp" />
</LinearLayout>
Upvotes: 1