L
L
lonata2018-09-05 17:28:50
Android
lonata, 2018-09-05 17:28:50

Why is the floating action button displayed incorrectly in the xml file?

Added an Action Floating Button to the xml markup, but the button doesn't look like many of the examples. What could be the reason?
How it should be:
5b8fe7a8a8e21421142759.jpeg
Like mine:
5b8fe7bba32ac534330218.jpeg
Icon :
5b8fe7d6d0c7e518677375.jpeg
xml file markup:

<?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"
    tools:context=".MainActivity">

    <ListView
        android:id="@+id/listItems"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </ListView>


    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
       android:src="@drawable/plus"

        android:layout_margin="16dp" />

</RelativeLayout>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Popov, 2018-09-06
@lonata

Here you can see how I connected

<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_marginRight="16dp"
        android:layout_marginBottom="40dp"
        app:borderWidth="0dp"
        app:elevation="6dp"
        app:backgroundTint="@color/IDЦвета"
        app:srcCompat="@drawable/IDТвоейИконки"
        android:layout_marginEnd="16dp" />

where IDColors - the background for the button
YourIDIcons - the path to the icon

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question