We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
这里有一些您正在寻找的链接。高级,但如果你坚持下去并且不放弃,你会学到很多东西!看一下:
Android:具有多个可点击按钮的 ListView 元素
带有嵌套的 Android 自定义列表项小部件
Here are some links for you are looking for. Advanced but if you stick with it and dont give up on this, you will learn a ton!!! Take a look:
Android: ListView elements with multiple clickable buttons
Android custom list item with nested widgets
在android和java中也可以使用listener来监听事件。在您的情况下,您想知道用户何时单击某个项目,因此您需要一个 onclicklistener 它将使用另一个列表视图调用另一个活动。
对于点击时的textview
我想你想谈谈Toast,它是屏幕底部的一种通知。
包含良好示例的链接: http://developer.android.com/guide /topics/ui/ui-events.html
In android and java too, you can use listener to listen event. In your case you want know when a user click on an item, so you'll need a onclicklistener which will call an another activity with another listview.
For the textview when clicking
I think you want speak of Toast, it's a kind of notification at the bottom of screen.
a link with good examples : http://developer.android.com/guide/topics/ui/ui-events.html
感谢大家提供的所有链接,非常有用!
我已经解决了我需要做的事情,它可能非常粗糙且效率低下,但至少在我了解更多之前它是有效的。
这允许我将几种不同的视图类型链接在一起。
Thanks for all the links everyone, Extremely useful!
I have solved what I needed to do, it might be extremely crude and inefficient but it works until I learn more at least.
This allows me to link together several different view types.
我不知道有什么好的教程,但对于您提出的第一个问题:
“我需要了解如何在单击第一个列表视图中的项目时显示另一个列表视图。”
我假设您想在同一活动中保留相同的列表视图。所以只需更改列表视图的适配器即可。如果它是基于光标的,请不要忘记管理您的光标。切换到新适配器后,调用
适配器的方法来刷新视图。
关于第二个问题“单击列表视图中的项目时如何显示文本视图。”,它对我来说太模糊了。你想做什么?直接就地编辑列表项,弹出一个包含编辑文本的对话框?
问候,
史蒂芬
I don't know of any good tutorial but for the first question you ask :
"I need to understand how I can show another listview when clicking on an item in the first listview."
I assume you want to keep the same list view in the same activity. So just change the adapter of the list view. If it's cursor based, don't forget to manage your cursor. Once you switched to the new adapter, call the
method of you adapter to refresh the view.
Regarding the second question "Also how I can display a textview when clicking on an item in a listview.", it's too fuzzy for me. What do you wanna do ? Edit a list item directly in place, popup a dialog with an edit text ?
Regards,
Stéphane