Mina Wissa
Mina Wissa

Reputation: 10971

Android: HorizontalScrollView in a ListView row Item, focus issue

I have a ListView that each item has a layout that contains a HorizontalScrollView. the problem is that I can't get the whole list item to be focused on when the user clicks or touches a list item.

how can I solve this ?

Thanks

Edit: the HorizontalScrollView looks like this:

<HorizontalScrollView
         android:layout_width="fill_parent"
    android:layout_height="wrap_content"

        android:fillViewport="true"
        android:scrollbars="none"
        android:focusable="false"
        android:fadingEdge="none"

        android:layout_weight="1"
        android:id="@+id/scrollView" 
        ></HorizontalScrollView>

Upvotes: 5

Views: 3313

Answers (2)

Mina Wissa
Mina Wissa

Reputation: 10971

OK Guys, I got it. in the LinearLayout wrapping my HorizontalScrollView I added the following attribute:

android:descendantFocusability="blocksDescendants"

so the HorizontalScrollView did not receive focus.

thanks

Upvotes: 8

Ron
Ron

Reputation: 24235

The Layout looks very complex with HorizontalScrollView inside a ListView. You should simplify your UI. Use a ExpandableListView. I feel it suits your UI requirement right.

Upvotes: 0

Related Questions