本文介绍了作为标签视图或活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展需要嵌套的标签(标签内标签)的应用程序。例如说我的标签之一是信息卡到我有四个tabs-收件箱,撰写,发送,垃圾。我有这样的嵌套的标签大约3-4在我的应用程序。我在寻找一些建议是否让这些标签单独活动或只是意见。我读过关于这个问题,我知道,这个问题是非常具体的,需要的应用程序。但作为一个初学者,我怀疑我的做法。起初,我不知道我是否应该在我的code这么多的活动,因为它会阻碍性能。截至目前我已经创建的主选项卡作为独立的活动和嵌套的标签为意见。对于大多数内标签的,我只希望用户从选项列表中选择,虽然有一对夫妇涉及多用户交互选项卡。可以通过活动的方式来实现的一切可以通过视图的方法是可能的吗?如果是这样,那么如何?任何建议将是有益的。

I'm developing an app which requires nested tabs (tabs within tabs). Say for example one of my tabs is a message tab into which I have four tabs- inbox, compose, sent, trash. I have around 3-4 of such nested tabs in my app. I'm looking for a few suggestions whether to make these tabs separate activities or just views. I've read about this issue and I'm aware that this problem is very much specific to the need of an application. But as a beginner I'm skeptical about my approach. Initially I wasn't sure if I should have so many activities in my code as it would hamper the performance. As of now I've created the main tabs as separate activities and the nested tabs as views. For most of the inner tabs I only want a user to select from a list of options, though there are a couple of tabs which involve more user interaction. Can everything that can be achieved by an activity approach is possible via view approach? If so, then How? Any suggestions would be helpful.

推荐答案

这听起来像你可以把这些嵌套的标签到不同的菜单选项,每个选项卡父的。在每一个在第一个选项卡菜单中选择您的活动,您可以添加此...

It sounds like you could make those nested tabs into different options menus for each of the parent tabs. In each of your activities in the first tab menu, you can add this...

@Override
public boolean onCreateOptionsMenu(Menu menu){
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.optionsmenu,menu);
    return true;
}

,然后实现一个监听器。

and then implement a listener..

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.one: 
        case R.id.two:
        default:
    }
    return true;
}

我认为这是提供更多的选择给用户的每个在你的选项卡菜单中活动的最佳途径。然后,您可以访问这些菜单为任何 TabActivity 用户是目前的每一个。他们只需要按下默认选项按钮。

I think that is the best way to offer more options to your users for each of the activities in your tab menu. You could then access each one of these menus for whichever TabActivity the user is currently on. They just have to push the default options button.

这篇关于作为标签视图或活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 17:41