Android: HorizontalScrollView in a ListView row Item, focus issue

老子叫甜甜 提交于 2019-12-10 14:28:27

问题


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>

回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/8806680/android-horizontalscrollview-in-a-listview-row-item-focus-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!