lundi 18 mai 2015

Keep one fragment with semi transparent background on the top layer

I'm trying to do this : |fragment menu (semi-transparent)| body (covered all the screen width) |

I have a menu in a fragment on the left of the screen and when I click on a menu button, I want open a new fragment in the body (body's size = screen's size). And I want that fragment menu must be still visible with a semi-trasnsparent background.

This is my xml layout :

<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:tools="http://ift.tt/LrGmb4"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="0dp"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    tools:context="com.example.MainActivity" 
    android:background="@drawable/background_image"
    >

    <fragment android:name="com.example.Principal_Menu"
              android:id="@+id/menu_fragment"
              android:layout_width="150dp"
              android:layout_height="match_parent" />

    <FrameLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/body_container"
        android:orientation="vertical">

    </FrameLayout>

</RelativeLayout>

But when I replace or add the fragment in the body_container the menu_fragment disappears :(
I hope was clear and I'm sorry to ask many questions.

Aucun commentaire:

Enregistrer un commentaire