开发者

HorizontalScrollView Inside an AlertDialog

I am adding custom views to a custom ArrayAdapter. The xml layout I am using looks like this

 <LinearLayout>
     <HorizontalScrollView>
     &开发者_运维技巧lt;LinearLayout>
        <TextView></TextView>
        <TextView></TextView>
        <TextView></TextView>
        <TextView></TextView>
    </LinearLayout>
   </HorizontalScrollView>
<LinearLayout>

I then set the adapter for my AlertDialog.Builder as my custom ArrayAdapter and also supply the OnClickListener. My dialog shows fine and I am able to scroll the list vertically as well as scroll each view horizontally. However, when I click on any of the views it never fires the OnClickListener.

I have tried setting the top most LinearLayouts descendantFocusability="blocksDescendants" but that has no effect. Is there anyway to do this within the AlertDialog? I have tried even creating a custom Dialog that implements OnGestureListener but none of the gesture events ever get called either.


I'm not sure if I'm able to reproduce the same problem you're describing, though I can reproduce something similar. Perhaps if you were to post a more complete and working code example, it could help to replicate your problem.

At any rate, the solution might be to not register the child components to have onClickListeners, because when they have onClickListeners, the parents then don't receive the click events.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜