【问题标题】:Having two actionbars in android?在android中有两个动作栏?
【发布时间】:2013-11-28 04:54:57
【问题描述】:

我目前有一个带有多个选项卡的操作栏,可以在不同的片段之间切换。我希望在下面有另一个“操作栏”来做同样的事情,最简单的方法是什么?

编辑:认为我应该澄清这就是我现在拥有的:http://i.imgur.com/kYtpUzt.jpg,这就是我想要实现的目标:http://i.imgur.com/q2DYIJT.png

【问题讨论】:

    标签: java android tabs android-actionbar


    【解决方案1】:
    // Custom action bar
            ActionBar actionBar = getActionBar();
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayShowTitleEnabled(false);
            actionBar.setDisplayShowCustomEnabled(true);
            actionBar.setCustomView(R.layout.action_bar);
    
            TextView title = (TextView) findViewById(android.R.id.text1);
            title.setText("Profile");
    

    action_bar.xml

    <?xml version="1.0" encoding="utf-8"?>
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/text1"
        style="@style/AppTheme"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:ellipsize="end"
        android:gravity="center_vertical" >
    
    </TextView>
    

    【讨论】:

    • 但是我已经有一个自定义操作栏了?我已经有类似imgur.com/kYtpUzt 的东西,当我点击类似imgur.com/q2DYIJT 的某个选项卡时,我想显示第二个操作栏@
    猜你喜欢
    • 2018-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 2020-07-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多