Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
通过单击一个选项卡,您应该启动一个
活动
。您只需触发一个Intent
即可。您启动的Activity
的作用以及它的外观完全取决于您。如果您通过单击选项卡启动
Activity
,则默认的 Android Activity 生命周期将启动,这意味着您可以在onCreate()
中的某个位置实现列表更新逻辑(如果适用)你。我强烈建议您阅读 http://d.android.com 上的文章和教程,因为您的主要问题似乎是是因为你不明白 Android 应该如何工作。
By clicking on a tab you are supposed to start an
Activity
. You simply fire off anIntent
. What theActivity
you start does and how it looks like is totally up to you.If you start an
Activity
through a tab click then the default Android Activity life cycle kicks in which means that you can implement your list updating logic somewhere inonCreate()
if appropriate for you.I highly recommend reading up the articles and tutorials on http://d.android.com as your main problem seems to be that you don't understand how Android is supposed to work.
Android 文档位于 http://developer.android.com/resources/ Tutorials/views/hello-tabwidget.html 指出:
也许这是一个过时的版本,在更高的 Android 版本中,创建活动是完成此任务的最干净的方法,但在文档中它指出也可以处理
Views
而不是Activities
。遗憾的是,该文档仅在其教程中描述了处理 Activites 的可能性。
The android documentation at http://developer.android.com/resources/tutorials/views/hello-tabwidget.html states:
Maybe this is an outdated version and in higher android versions creating an activity is the cleanest way to accomplish this task, but in the documentation it states that it is also possible to handle
Views
instead ofActivities
.Sadly the documentation only describes the possibility of handling Activites in its tutorial.