简体   繁体   English

ActionBar-Android中的条显示不正确的白色背景色

[英]ActionBar - incorrect white background color displayed of the bars in Android

I've attached a image to describe my problem. 我已附上一张图片来描述我的问题。 I don't know why at the end of the bars there is a white piece when the background of the them is green. 我不知道为什么当酒吧的背景为绿色时,酒吧的尽头有白色的一块。 If someone could help me. 如果有人可以帮助我。 I am using native ActionBar but i am customazing the tabs of its...I have been trying to change the widht of the bars, the background color, etc and I can not find any solution. 我正在使用本机ActionBar,但我正在自定义其选项卡...我一直在尝试更改条的宽度,背景色等,但找不到任何解决方案。 This image is happen using Samsung Galaxy Tab with Android 4.0.4: 此图像是使用带有Android 4.0.4的Samsung Galaxy Tab发生的:

在此处输入图片说明

Some piece of code is: 一段代码是:

    ActionBar aBar = getActionBar();
    aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    aBar.setDisplayShowTitleEnabled(false);
    aBar.setBackgroundDrawable(getResources().getDrawable(R.color.color_action_bar));
    aBar.setDisplayUseLogoEnabled(true);


    mTabManager = new TabletTabManager(this);

    ((TabletTabManager)mTabManager).addTab(
        aBar.newTab().setCustomView(createCustomTab(R.drawable.my_cameras, R.string.my_cameras)), 
        CamerasFragment.class, 
        CamerasFragment.getArguments(CamerasFragment.Mode.MY_CAMERAS));

The problem was the width of the tabs. 问题是标签的宽度。 I didn't set any width for the tabs only I used WRAP_CONTENT so the tabview was taking the size of the tab where the text was longest. 我仅使用WRAP_CONTENT来设置选项卡的宽度,所以选项卡视图使用的是文本最长的选项卡的大小。 In this way some of the tabs, except the biggest, was showing a white background in the tab indicator. 这样,除了最大的选项卡外,其他一些选项卡在选项卡指示器中显示白色背景。

Now, I've changed this and I've written the same width for all of them. 现在,我更改了此设置,并为所有这些设置了相同的宽度。

When you work with tabs in the action bar take care with the width because when you turn the device in portrait you could have a lot problems, especially, in the new tablets of 7inch. 使用操作栏中的选项卡时,请注意宽度,因为当您纵向旋转设备时,可能会遇到很多问题,尤其是在新的7英寸平板电脑中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM