1
resposta

Aula 3 - Como colocar o floatingActionButton no canto inferior direito?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/floatingActionButton2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:clickable="true"
    app:srcCompat="@mipmap/ic_launcher" />

<ListView
    android:id="@+id/activity_main_lista_de_alunos"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true"
    android:layout_marginStart="3dp"
    android:layout_marginTop="0dp"
    android:layout_marginBottom="-90dp">

</ListView>




</RelativeLayout>

Esse é o xml referente a atividade da aula 3, após colocar em RelativeLayout não consigo mover o botão para baixo.

1 resposta

Mauricio, tudo bem ?

Cara tu inverteu as ordens ai! hehehe

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    ListView
    android:id="@+id/activity_main_lista_de_alunos"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/floatingActionButton2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentEnd="true"
    android:layout_alignParentBottom="true"
    android:layout_marginEnd="10dp"
    android:layout_marginBottom="10dp"/>





</RelativeLayout>