哪个选项卡更好的选择?

发布于 2025-01-04 23:49:26 字数 204 浏览 5 评论 0原文

我已经阅读了带有活动和视图的选项卡的不同示例。我知道每种方法都有一定的局限性。目前我想知道哪一个更适合我的问题。我有 4 个选项卡,每个选项卡都有相同的列表视图,但每个列表的内容会有所不同。

我尝试过以下方法: 创建选项卡活动并为列表提供单个活动,并为每个选项卡加载具有不同内容的相同列表。不知何故,这似乎不是正确的方法。

帮我找到一个好的方法。谢谢快乐编码!!

I have read different examples for tabs with activities and views. I know there are certain limitations for each. Currently i want to know which one would be a better option for my problem. I have 4 tabs and each of them have the same list view but the content of each list would be different.

I have tried the following approach:
Creating the tab activity and having single activity for list and loading the same list for each tab with different content altogether. Somehow this does not seem to be correct way.

Help me find a good approach. Thanks Happy Coding!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

伴我老 2025-01-11 23:49:27

最好为每个列表实施不同的活动。

It's better to implement a different activity for each list.

情归归情 2025-01-11 23:49:26

对不同的选项卡使用不同的活动。像这样:

intent = new Intent().setClass(Tabhost.this, ArtistsActivity.class);

// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("artists").setIndicator("Artists",
                  res.getDrawable(R.drawable.ic_tab_artists))
              .setContent(intent);
tabHost.addTab(spec);

看看 android 开发者网站

Use different activity for different tab.Like this:

intent = new Intent().setClass(Tabhost.this, ArtistsActivity.class);

// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("artists").setIndicator("Artists",
                  res.getDrawable(R.drawable.ic_tab_artists))
              .setContent(intent);
tabHost.addTab(spec);

And have a look android developer site.

是伱的 2025-01-11 23:49:26

您可以简单地更新列表的内容,而不在单击选项卡时更新视图。

You could simply update the content of the list and don't update the view when you click the tabs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文