How to make a Floating Action Button?

Asked

Viewed 9,344 times

2

I am developing an application for Android, I would like to know or some example to include a Floating Action Button?

This Floating Action Button would be a shortcut to a system action, in my case it would call an Activity. This button would have a behavior similar to the app Youtube, which contains this button/phone camera shortcut.

inserir a descrição da imagem aqui

  • 2

    Oops, good afternoon. Do you have a print of any visual example of this button? Would it be the Float Action Button? (http://www.androidhive.info/wp-content/uploads/2015/12/android-floating-action-button-2.png)

  • Antonio, exactly that, I didn’t really know the name of this button, I looked as widget but I couldn’t find anything I wanted. Do you know the minimum version of support for this button? Thanks Antonio!

  • You say create a component that you can add the home screen for example... How there is for weather forecast etc..??

  • Marco, no, it would be a Float Action Button even, as I said, I didn’t really know what was called this button that was floating on the screens, I thought it was a widget, but I was wrong.

  • Whoa, good afternoon, guys. The button would then be the FAB (Float Action Button) and to create it has a nice tutorial here: http://www.android4devs.com/2015/03/how-to-make-floating-action-buttonfab.html

  • See example: http://answall.com/questions/125807/painel-floating

  • I made an issue to your question to include the new details, can do also you whenever you ask. If you don’t like it you can revert to the previous edition.

Show 2 more comments

1 answer

3

Floatingactionbutton

There is a guide to using the library that explains how and when to use the floating button correctly in new or existing projects.

Example of use:

<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"
        android:src="@android:drawable/ic_hoje_eh_sexta_feira" />

Dependency libraries

build.Gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
}

Google launched a support tool during the Google I/O 2015.

Floatingactionbutton Animated

inserir a descrição da imagem aqui

Check the Floating Action Button of Material Design of Google itself.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.