如何设置选项卡的底部,还隐藏了顶级动作条? [英] How can I set tabs at the bottom and also hide top actionbar?

查看:84
本文介绍了如何设置选项卡的底部,还隐藏了顶级动作条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用我使用的动作条选项卡底部。我已经搜索很多教程,但我不理解的解决方案。大部分的答案所述使用TabActivity,但这是pcated德$ P $。因此,任何一个可以告诉我怎么才能接近这个?

In my application I am using actionbar tabs at bottom. I have searched many tutorials but I am not understanding the solutions. Most of the answers said to use TabActivity, but that is deprecated. So can any one tell me how can approach this?

推荐答案

这是一个例子

Toolbar toolbarBottom = (Toolbar) findViewById(R.id.toolbar_bottom);
    toolbarBottom.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch(item.getItemId()){
                case R.id.action_settings:
                    // TODO
                    break;
                // TODO: Other cases
            }
            return true;
        }
    });
    // Inflate a menu to be displayed in the toolbar
    toolbarBottom.inflateMenu(R.menu.menu_main);

和这个XML

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar_bottom"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:background="?attr/colorPrimary"
    android:layout_alignParentBottom="true"
    android:minHeight="?attr/actionBarSize" />

这篇关于如何设置选项卡的底部,还隐藏了顶级动作条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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