安卓:在列表视图多个操作 - 焦点问题 [英] Android : Multiple Actions on a List View - Focus Issue

查看:212
本文介绍了安卓:在列表视图多个操作 - 焦点问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个ListView,这是我可以做的没有问题瓦特/我的光标。眼下,这取决于行你点击它带你到一个新的活动的基础上pssed在该行的信息$ P $(就像它应该和预期)。我想有一个按钮,但删除的行,这样用户就可以preSS任何部分行推出新的活动,但如果他们preSS在该行的按钮,它删除了该行(或启动删除活动/功能)。

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 information pressed on that row (just like it should, and as expected). I would like to have a button however to delete the row, so a user can press any part of the row to launch the new activity, but if they press the button on that row, it deletes the row (or launches a delete activity/function).

如果你可以看看@ DroidRecord,他们有一个类似的布局,因为我看才达到。

If you can look @ DroidRecord, they have a similar layout as I am looking to achive.

谢谢!

克里斯。

推荐答案

你有什么问题吗?如何添加一个按钮,一个列表行?

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.

不幸的是,虽然这也将使整个行贱民。在谷歌开发者,我问说,这是由设计(据我记不清了),那你应该使用TouchDelegate来应对这个问题。由于没有样品,甚至没有在Android源代码,只有很薄的这并没有为我工作文档

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

无论如何,它似乎没有多少应用程序的列表行中使用的按钮。我只知道我的( newsrob ,请参阅文章列表)和闹钟。也许你可以使用右键菜单?

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?

否则,丑陋的解决方案是添加调用setOnClickListener()在你的行视图中的getView方法。

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

干杯

这篇关于安卓:在列表视图多个操作 - 焦点问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆