Skip to content Skip to sidebar Skip to footer

Transparent ActionBar And StatusBar In Android Lollipop

I am trying to create this interface : And here is my actual result : The status bar is well transparent and we see my image as background : OK The action bar is not transparent

Solution 1:

You can change your toolbar color to transparent like this:

mToolbar.setBackgroundColor(getResources().getColor(android.R.color.transparent));

You can change it's background on the XML too:

android:background="@android:color/transparent"

Or if you're using ActionBar:

getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

Use getActionBar() if you're not using ActionBarActivity

Result:

enter image description here


Solution 2:

Use this style:

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="android:textColorPrimary">@color/my_text_color</item>
    <item name="colorPrimary">@android:color/transparent</item>
    <item name="windowActionBarOverlay">true</item>
</style>

Solution 3:

For API that >= 21, add to theme these lines of code

<item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:statusBarColor">@android:color/transparent</item>

Don't forget to add

android:fitsSystemWindows="true"


Post a Comment for "Transparent ActionBar And StatusBar In Android Lollipop"