Android : Multiple Actions on a List View - Focus Issue

前端 未结 6 975
醉酒成梦
醉酒成梦 2021-02-06 02:55

I would like to implement a ListView, which I can do no problem w/ my cursor. Right now depending on which row you click on it takes you to a new activity based on the informati

6条回答
  •  余生分开走
    2021-02-06 03:30

    what is your question? How to add a button to a list row?

    Very simple, just as you expect it will be added to the row's layout.

    Unfortunately though that will also make the whole row "untouchable". The Google developer I asked said that this is by design (as far as I remember), and that you should use TouchDelegate to cope with this. As there are no samples, not even in the android source, and only very thin documentation that didn't work for me

    Anyway, it seems that not many applications use a button in the list row. I only know about mine (newsrob, see Articles List) and the Alarm clock. Maybe you could use a context menu?

    Otherwise the ugly solution would be to add to call setOnClickListener() on your row view in the getView method.

    Cheers

提交回复
热议问题