【问题标题】:Android transparent toolbar over an ImageViewImageView 上的 Android 透明工具栏
【发布时间】:2015-07-05 17:38:27
【问题描述】:

我正在尝试拥有一个transparent toolbar

这样它将在 上显示 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):

所以,它是透明的,但它会将ImageView 向下推,而不是在它上面。

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

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    使用框架布局

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

    这应该会有所帮助

    【讨论】:

      【解决方案2】:

      工具栏只是 ViewGroup。所以考虑制作类似相对布局的布局。 在相对布局中,你有这样的顺序:布局代码中的较低位置,那么这个视图将被认为是布局的最高层。因此,将您的观点按正确的顺序排列,您将获得预期的结果。以前为我工作过很多次。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-02-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-27
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多