how to set onClick method with linearLayout?

前端 未结 4 1126
迷失自我
迷失自我 2020-12-14 00:36

I am creating an application and posted a question yesterday how to start activity by click any where on row. Got an idea to do like below but I am getting this erro

4条回答
  •  离开以前
    2020-12-14 00:57

    From your xml layout file i think what you are looking for is a listview, not loads of linearlayouts. Here is nice tutorial to get you started, might be exactly what you need, row with image and text. For the listview just use setOnItemCLickListener().

    Back to what you want, I think you need to make the linearlayout focusable/touchable in order to "receive" clicks.

提交回复
热议问题