Overlay image on Action Bar

一笑奈何 提交于 2019-12-07 22:32:15

问题


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?


回答1:


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);



回答2:


Check this answer.

This one worked perfectly in my project.

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



来源:https://stackoverflow.com/questions/30421026/overlay-image-on-action-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!