Linearlayout over a listview

Asked

Viewed 133 times

1

I have a Linearlayout that I want that when it gets VISIBLE it overlaps a listview, how to do this? I want my optional Linearlayout to override listview when it is set to VISIBLE.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">


<LinearLayout
    android:id="@+id/opcaoOrdenar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/linearLayout"
    android:gravity="center"
    android:weightSum="1"
    android:visibility="gone">

    <RadioGroup
        android:id="@+id/radioGroupData"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.36"
        android:orientation="vertical"
        >

        <RadioButton
            android:id="@+id/maiorData"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:text="Maior data" />

        <RadioButton
            android:id="@+id/menorData"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/questao"
            android:layout_toEndOf="@+id/sim"
            android:text="Menor data" />

    </RadioGroup>

    <RadioGroup
        android:id="@+id/radioGroupResultado"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true">

        <RadioButton
            android:id="@+id/melhorResultado"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/questao"

            android:layout_toEndOf="@+id/sim"
            android:text="Melhor resultado" />

        <RadioButton
            android:id="@+id/piorResultado"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/questao"
            android:layout_toEndOf="@+id/sim"
            android:text="Pior resultado" />

    </RadioGroup>


</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@color/cinza">

    <Button
        android:id="@+id/ordenaramc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:background="@color/azulgerdau"
        android:text="Ordenar"
        android:textColor="@color/cinza" />

    <Button
        android:id="@+id/buscarAmc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:background="@color/azulgerdau"
        android:onClick="buscarAmc"
        android:text="Buscar"
        android:textColor="@color/cinza" />

    <Button
        android:id="@+id/adicionarAmc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentTop="true"
        android:layout_weight="0.5"
        android:background="@color/azulgerdau"
        android:onClick="adicionarAmc"
        android:text="Adicionar"
        android:textColor="@color/cinza" />

</LinearLayout>

<ListView
    android:id="@+id/listaAmc"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/linearLayout"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"></ListView>

  • You can put the visibility of yourListView for View.GONE, while its layout for VISIBLE

1 answer

0


Only set it last within Relativelayout, ie move pro end of code. In Relativelayout or Framelayout the views are being "stacked" according to the order in which they are defined, that is, the last one is the one that is higher up.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.