2
Could you help me? I’m trying to make the Floatingactionbutton appear on my screen but it doesn’t want to appear I don’t know what I do anymore...I’m a long time trying to solve this problem but I can’t solve it :(
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_container"
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"
android:background="#FFFFFF"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="br.com.gruporecursos.noamobile.AlertaFragment"
android:orientation="vertical">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/lstAlerta"
    android:dividerHeight="2dp"
    android:divider="#ECECEC"/>
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@android:drawable/ic_menu_edit"
        />
    </LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
						
Instead of
app:srcCompat="@android:drawable/ic_menu_edit"useandroid:src="@android:drawable/ic_menu_edit". Let me know if that was the problem.– ramaral
Since you are using Floatingactionbutton inside a Linearlayout and have a Listview above it, you must assign
android:layout_weight="1"Listview so that this does not "push" the Floatingactionbutton off the screen. You can use a Coordinatorlayout as Ack Lay explains in your reply, however, in a simple layout like this, theandroid:layout_weight="1"solves the problem.– ramaral