2015-04-27 135 views
3

我想有一个transparent toolbarAndroid的透明工具栏

,这样它将对的ImageView其顶部设置如下显示

<ImageView 

    android:layout_width="fill_parent" 
    android:layout_height="0px" 
    android:layout_weight="8" 
    android:scaleType="center" 
    android:id="@+id/imageView" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:elevation="0dp" 
    /> 

插图(蓝色区域为ImageView):

enter image description here

所以,它是透明的,但它推动了ImageView,而不是在它之上。

我也试过使用android:elevation,但它没有帮助。

回答

3

使用框架布局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    // Your imageview 

    <ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"/> 

    //your toolbar 


</FrameLayout> 

这应该有助于

4

工具栏只是ViewGroup。所以考虑制作像相对布局的布局。 在相对布局中,您有这样的顺序:布局代码中的较低位置,则该视图将被视为布局的最高层。因此,请按照正确的顺序放置您的视图,您将获得理想的结果。之前为我工作过很多次。

+0

烨偶数帧布局也为这部作品PLUS1。 – mcd

相关问题