Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中的自定义actionbar选项卡_Android_Android Actionbar - Fatal编程技术网

android中的自定义actionbar选项卡

android中的自定义actionbar选项卡,android,android-actionbar,Android,Android Actionbar,我试图改变标签背景的颜色,指示器的颜色和我的actionbar标签的文本颜色,但我似乎无法正确地进行 下面是我的一些相关代码 styles.xml <resources> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer de

我试图改变标签背景的颜色,指示器的颜色和我的actionbar标签的文本颜色,但我似乎无法正确地进行

下面是我的一些相关代码

styles.xml

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.

    -->
    <style name="AppBaseTheme" parent="Theme.AppCompat.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.

        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>

我找到了杰夫·吉尔费尔特制作的这个actionBar主题生成器。非常有用的工具。只需设置所需的设计下载文件,复制并粘贴到项目的res文件夹中,即可完成

确保在构建或测试应用程序之前先清理项目

actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.actionBarBG)));
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(true);

android.app.ActionBar.Tab tab1 = actionBar.newTab().setText("Unposted")
                .setTabListener(VisitDates.this);

android.app.ActionBar.Tab tab2 = actionBar.newTab().setText("Posted")
                .setTabListener(VisitDates.this);

android.app.ActionBar.Tab tab3 = actionBar.newTab()
                .setText("All visits").setTabListener(VisitDates.this);

actionBar.addTab(tab1);
actionBar.addTab(tab2);
actionBar.addTab(tab3);
actionBar.selectTab(tab1);