如何使线性布局背景透明? [英] How to make Linear Layout Background Transparent?

查看:58
本文介绍了如何使线性布局背景透明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用半圆实现滚动功能我无法达到这个我想让该线性布局透明并且只有图像视图可见.这里的问题是线性布局的边缘导致功能失败.

I'm trying to achieve a scroll feature with a semi-circle I'm unable to reach this I want to make that linear layout transparent and just the image view to be visible. The problem here is it the edges of the linear layout which makes the feature fail.

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/linear"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:background="@null">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:background="@drawable/rect_background" />

    </LinearLayout>


    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="fill_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"




        </LinearLayout>

    </ScrollView>

</LinearLayout>

推荐答案

使用 FrameLayout 并在其中添加这两个布局.在 FrameLayout 中,最后添加的元素将位于其他元素之上.

Use FrameLayout and add these two layouts in it. in FrameLayout, whichever element is last added will be on top of others.

所以在这里,首先在 FrameLayout 中添加 topper 布局,然后添加包含 Avatar 图像的 ScrollView Layout.

SO here, add topper layout first in FrameLayout and then add ScrollView Layout which contains Avatar image.

这样,头像图片将位于顶部栏布局的顶部

That way, avatar image will be on top of topbar layout

<FrameLayout>

    <LinearLayout> //topbar
    <LinearLayout> //ScrollView containing avatar and other stuff

</FrameLayout>

这篇关于如何使线性布局背景透明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆