0

I'm trying to transparent all navigation tabs and the entire tab bar that contain them so that ActionBar's background can be seen through them.

I have tried this for hours and what I have managed is to make navigation tabs transparent.

<!-- individual ActionBar tabs style -->
<style name="MyTabStyle" parent ="Widget.AppCompat.Light.ActionBar.TabView">
    <item name ="android:background">@android:color/transparent</item>
</style>

When I try to make the entire TabBar that contain my navigation tabs transparent, it ends up becoming white

<!-- ActionBar overall tab bar style -->
<style name="MyTabBarStyle" parent ="Widget.AppCompat.Light.ActionBar.TabBar">
    <item name ="android:background">@android:color/transparent</item>
</style>

what should I do to make it transparent? I'm using Theme.AppCompact.Light>DarkActionBar as the parent of my app theme.

EDIT

my apps theme

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
    <item name ="android:actionBarTabBarStyle">@style/MyTabBarStyle</item>
    <item name ="android:actionBarTabStyle">@style/MyTabStyle</item>
    <item name="android:actionMenuTextColor">@color/app_yellow</item>

    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/MyActionBar</item>
    <item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
    <item name ="actionBarTabBarStyle">@style/MyTabBarStyle</item>
    <item name ="actionBarTabStyle">@style/MyTabStyle</item>
    <item name="actionMenuTextColor">@color/app_yellow</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">

    <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>

    <!-- Support library compatibility -->
    <item name="titleTextStyle">@style/MyActionBarTitleText</item>
    <item name="background">@drawable/actionbar</item>
</style>

in my activity

final ActionBar actionBar = getSupportActionBar();
    // Specify that tabs should be displayed in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setLogo(R.mipmap.ic_launcher);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
Edijae Crusar
  • 3,473
  • 3
  • 37
  • 74

1 Answers1

0

After a long struggle, i solved the problem by implementing a toolbar instead of an actionbar and then putting a transparent tablayout which will hold my tabs in that toolbar. doing this, i was able to have transparent tabs(item1,item2,item3) where i can see my toolbar(Which i set as my actionbar) background's image.

enter image description here

Click this link to see my implementation

Community
  • 1
  • 1
Edijae Crusar
  • 3,473
  • 3
  • 37
  • 74