如何为透明设置ActionBar并将其保留在ImageView上 [英] How to set ActionBar for transaparent and keep it over ImageView
本文介绍了如何为透明设置ActionBar并将其保留在ImageView上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使ActionBar透明,并使其在图像上方(如此图片所示).如何设置?
I want to make the ActionBar transparent and it above the image like this picture. How set it?
推荐答案
布局
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_white"
android:minHeight="?attr/actionBarSize" />
<FrameLayout
android:id="@+id/framelayout_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
解决方案1#
//whole toolbar will be transparent
mToolbar.setAlpha(0.0f);
解决方案2#
//only background of toolbar will be transparent
mToolbar.getBackground().setAlpha(0);
这篇关于如何为透明设置ActionBar并将其保留在ImageView上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文