Android ImageView 上方透明的工具栏

3
我试图创建一个 透明工具栏,使其显示在以下设置的 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,但没有帮助。
2个回答

4

使用帧布局

  <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。因此,请考虑像相对布局一样制作布局。 在相对布局中,您需要按以下顺序:在布局代码中较低的位置,然后此视图将被视为布局的最高层。因此,请正确排列您的视图,您将获得所需的结果。这种方法在我之前很多次都有效。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接