简体   繁体   中英

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. This image is happen using Samsung Galaxy Tab with Android 4.0.4:

在此处输入图片说明

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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