LinearLayout About Other LinearLayout

2

I have a layout in Android Studio that I would like to have on another layout, but I can not do it in any way. I would like it to stay on top as it is a menu that appears when someone presses the swap image button.

Layout:

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ViewController.ConfiguracaoViewController"
android:background="#FFF"
android:weightSum="1">

<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme">
        <android.support.v7.widget.Toolbar
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/colorPrimary"
            android:fitsSystemWindows="true"
            android:id="@+id/toolbar"
            >

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/voltar"
                android:layout_gravity="start"
                android:background="@android:color/transparent"
                android:drawableStart="@drawable/voltar"
                android:id="@+id/voltar_btn"
                android:textColor="#FFF"
                android:onClick="Voltar"
                />
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/configuracao"
                android:textAlignment="center"
                android:textSize="22sp"
                android:textColor="#FFF"
                android:paddingStart="0dp"
                android:paddingEnd="100dp"
                />

        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.AppBarLayout>

    <io.codetail.widget.RevealFrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <include layout="@layout/menu_anexo"/>
    </io.codetail.widget.RevealFrameLayout>





    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="125dp"
        android:layout_marginTop="10dp"
        android:layout_gravity="center">
        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:id="@+id/usuario_image"
            android:src="@drawable/muscleman"
            android:layout_marginStart="15dp"
            android:layout_marginTop="10dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="@string/nome_do_usuario"
            android:id="@+id/nome_usuario_text"
            android:layout_marginTop="35dp"
            android:layout_marginStart="10dp"
            android:textSize="19sp"
            android:textColor="#000"/>
    </LinearLayout>
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/sincronizar"
        android:id="@+id/sincronizar_btn"
        android:layout_gravity="center_vertical"
        android:layout_marginTop="10dp"
        android:background="#22BB5B"
        android:onClick="Sincronizar"/>
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/trocar_senha"
        android:id="@+id/trocar_senha_btn"
        android:layout_gravity="center_vertical"
        android:layout_marginTop="10dp"
        android:background="#22BB5B"
        android:onClick="TrocarSenha"/>
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/trocar_fofo"
        android:id="@+id/trocar_foto"
        android:layout_gravity="center_vertical"
        android:layout_marginTop="10dp"
        android:background="#22BB5B"
        android:onClick="TrocarFoto"/>
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/politica_privacidade"
        android:id="@+id/politica_privacidade_btn"
        android:layout_gravity="center_vertical"
        android:layout_marginTop="10dp"
        android:background="#22BB5B"/>
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/sair"
        android:id="@+id/sair_btn"
        android:layout_gravity="center_vertical"
        android:layout_marginTop="30dp"
        android:background="#22BB5B"/>
</LinearLayout>

How Design behaves:

    
asked by anonymous 15.09.2016 / 19:24

2 answers

3

You can insert a LinearLayout over another LinearLayout using RelativeLayout . RelativeLayout is a layout that organizes its components and is one of the Layout most used in Android . The position of each of the components can be specified according to the relation of the "brother" element (such as to the left, from or below another point of view).

  

Relative Layout: Organize the elements relative to one another or the parent

Example

<?xmlversion="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp" >
    <LinearLayout
        android:id="@+id/name"
        android:layout_width="300dp"
        android:layout_height="400dp" />

  <LinearLayout
        android:id="@+id/name"
        android:layout_width="200dp"
        android:layout_height="300dp" />

</RelativeLayout>

Details

15.09.2016 / 21:25
0

use setVisibility to make visible the layout you want to show to the user depending on the action.

setVisibility

    
15.09.2016 / 21:03