简体   繁体   中英

Overlay image on Action Bar

How do I overlay image over an Action Bar and status bar ? Here is what I want it to look like -

目标

I read this but it gives different results than what I want. The Action Bar still has some opacity and the status bar has no effect at all.

Is there any way to do this?

Add these two lines of code to your styles-v21.xml file:

<item name="android:windowTranslucentStatus">true</item>
<item name="windowActionModeOverlay">true</item>

Edit: You want it in the v21 file because Android versions below 5.0 don't support this.

Also...for Material Design, you should be using a ToolBar not an Action Bar . Here's how to change the color of a Toolbar.

toolbar.getBackground().setAlpha(0);

Check this answer.

This one worked perfectly in my project.

This library is also great to explore: https://github.com/ManuelPeinado/FadingActionBar

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