Sharan
Sharan

Reputation: 1275

How to make Linear Layout Background Transparent?

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>

Upvotes: 1

Views: 3976

Answers (3)

stry-kai
stry-kai

Reputation: 493

I know this is old but if you stumbled on this post then add this to your style.xml

<style name="ProgressDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="android:windowBackground">@android:color/transparent</item>
</style>

Then use it programmatically like this, assuming your progress dialog is in a linear layout

dialog = Dialog(this, R.style.ProgressDialogTheme)
    dialog.setContentView(R.layout.progress)
    dialog.setCanceledOnTouchOutside(true)

Upvotes: 2

Daniel Albiol
Daniel Albiol

Reputation: 19

Try putting this on your LinearLayout:

android:background="@android:color/transparent"

Upvotes: 2

Jay Patel
Jay Patel

Reputation: 516

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

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>

Upvotes: 1

Related Questions