Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

sobre Floating Action Button

Quando coloco FoatingActionButton no layout ele não aparece e quando faço a conver view (RelativeLayout)minha list sume não aparece mais no emulador . Alguem pode me ajudar?

?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <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/floatingActionButton6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:clickable="true"
            app:srcCompat="@mipmap/ic_launcher" />
    </ListView>
</RelativeLayout>
2 respostas

Oi Marisa, o problema é que seu FloatingActionButton está dentro da ListView e não no RelativeLayout.

Você pode tentar utiliza-lo da seguinte forma:

<?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">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent">


    </ListView>


    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/floatingActionButton6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_margin="16dp"
        android:clickable="true"
        app:srcCompat="@mipmap/ic_launcher" />
</RelativeLayout>
solução!

Muito obrigada Igor

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software