jack_the_beast
jack_the_beast

Reputation: 1971

relative layout transparent, but i want it opaque

I've a RelativeLayout whith the visibility set to GONE. when I do certain things, the visibility is set toVISIBLE`and the layout is displayed. The problem is that it should overlap the other contents of the activity, but it's not, I can see the element of the layout but also the activity contents (see the image)

I want the overlapping layout to be opaque. I've tried to set the backgroud to a color (tried with both ARGB and RGB) and set the alpha (which should be the same as the ARGB) but id doesn't work. any idea?

here is the xml:

 <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="10dp"
        android:id="@+id/doc_main_aivalability_panel"
        android:visibility="gone"
        android:background="@color/appBackground">
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/doc_main_aivalability_save"
        android:text="salva"
        android:layout_alignParentBottom="true" />
    <ListView
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:id="@+id/doc_main_aivalability_list"
        android:layout_above="@id/doc_main_aivalability_save"
        android:background="@color/appBackground"/>

    </RelativeLayout>

    <CalendarView 
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:id="@+id/doc_main_availability_calendar"/>

the color I am using:

<color name="appBackground">#FFF2F2F2</color>

and a screenshot: screenshot

Upvotes: 0

Views: 802

Answers (2)

Gil Julio
Gil Julio

Reputation: 812

The resource called appBackground starts with FF and has 8 digits. This means that the color is full transparent. Please refer to this answer.

https://stackoverflow.com/a/16890937/973325

To fix it just change it to

<color name="appBackground">#F2F2F2</color>

Upvotes: 1

imort
imort

Reputation: 106

Swap RelativeLayout and CalendarView in xml

Because the tree is traversed in-order, this means that parents will be drawn before (i.e., behind) their children, with siblings drawn in the order they appear in the tree.

Docs

Upvotes: 1

Related Questions