Android的 - 动作条pre蜂窝 [英] Android - ActionBar pre Honeycomb

查看:182
本文介绍了Android的 - 动作条pre蜂窝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好,

我希望有人能够帮助我。

即时通讯开发一个应用程序,在这里我用的是操作栏,从为pre 3.0设备的支持库,但我有问题,那espacially在pre 3.0装置不动作栏显示。当我使用的设备,这是高于3.0正常工作。

我已经按照这些教程: http://developer.android.com/guide/topics/ui/actionbar html的#添加

所以,我的主要活动,它处理的操作栏,从ActionBarActivity延伸。

在这一刻,我想通了,我的卡毫无疑问的原因。

我的code是这样的:

  

@覆盖       保护无效的onCreate(包savedInstanceState){           super.onCreate(savedInstanceState);
          //的setContentView(R.layout.activity_hauptmenue_extended);

 尝试{
        Log.d(测试,集动作条......);

        动作条= getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.show();

        标签塔布= actionBar.newTab();
        tabB.setText(家);
        tabB.setIcon(R.drawable.icon_home);
        tabB.setTabListener(新TabListener< Startmenue_activity>(这一点,
                开始,Startmenue_activity.class));
        actionBar.addTab(塔布);

        标签塔巴= actionBar.newTab();
        tabA.setText();
        tabA.setIcon(R.drawable.icon_nachrichten_sel);
        tabA.setTabListener(新TabListener< Nachrichten_activity>(这一点,
                新闻报,Nachrichten_activity.class));
        actionBar.addTab(塔巴);

        标签TABC = actionBar.newTab();
        tabC.setText();
        tabC.setIcon(R.drawable.icon_favoriten);
        tabC.setTabListener(新TabListener< Favoriten_activity>(这一点,
                法沃里滕,Favoriten_activity.class));
        actionBar.addTab(TABC);

    }赶上(例外前){
        HelperClassAlertDialog.zeigeInfoDialog(这一点,错误......
                ex.getMessage(),);
    }
}
 

当我删除添加标签的一部分,行动起来吧正常工作!但是,当我添加了标签了,没有动作栏显示。但也有没有错误!

我真的很希望,有人能帮助我。 :(

解决方案

下面的问题和答案帮助我:

使用标签android.support.v7.app.ActionBar

或者这样:

<一个href="http://stackoverflow.com/questions/17881297/actionbar-with-support-library-and-fragments-overlay-content">ActionBar与支持库和碎片覆盖内容

解决方案

您必须使用 ActionBarSherlock 。这是一个图书馆。从链接。 这里是关于如何使用教程 ActionBarSherlock

Good evening,

i hope somebody could help me.

Im developing a app where i use the action bar from the support library for pre 3.0-devices, but i have the problem, that espacially on the pre 3.0-devices no action bar is showing. When i use a device, which is higher then 3.0 it works fine.

I've followed these tutorial: http://developer.android.com/guide/topics/ui/actionbar.html#Adding

So my "main activity", which handles the action bar, extends from "ActionBarActivity".

At these moment i figured out, that my tabs the undoubted cause.

My code looks like this:

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_hauptmenue_extended);

    try {
        Log.d("test", "Set ActionBar...");

        actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.show();

        Tab tabB = actionBar.newTab();
        tabB.setText("Home");
        tabB.setIcon(R.drawable.icon_home);
        tabB.setTabListener(new TabListener<Startmenue_activity>(this,
                "Start", Startmenue_activity.class));
        actionBar.addTab(tabB);

        Tab tabA = actionBar.newTab();
        tabA.setText("");
        tabA.setIcon(R.drawable.icon_nachrichten_sel);
        tabA.setTabListener(new TabListener<Nachrichten_activity>(this,
                "Nachrichten", Nachrichten_activity.class));
        actionBar.addTab(tabA);

        Tab tabC = actionBar.newTab();
        tabC.setText("");
        tabC.setIcon(R.drawable.icon_favoriten);
        tabC.setTabListener(new TabListener<Favoriten_activity>(this,
                "Favoriten", Favoriten_activity.class));
        actionBar.addTab(tabC);

    } catch (Exception ex) {
        HelperClassAlertDialog.zeigeInfoDialog(this, "Error...",
                ex.getMessage(), "");
    }
}

When i delete the part of adding the tabs, the action bar works fine! But when i add the "tabs" again, no action bar is showing. But there are also no errors!

I really hope, somebody could help me. :(

Solution:

The following question and answer help me:

Tabs using android.support.v7.app.ActionBar

Or this:

ActionBar with support library and Fragments overlay content

解决方案

You have to use ActionBarSherlock. It's a library. Download it from this link. Here is a tutorial on how to use ActionBarSherlock.

这篇关于Android的 - 动作条pre蜂窝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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