10

Is there a way I can Achieve the floating button to work on 4.0 and later android??

I've seen it on google plus but I haven't found any tutorial. Only for android l preview. What did google+ use to achieve it?

enter image description here

enter image description here

Thanh-Nhon Nguyen
  • 3,402
  • 3
  • 28
  • 41
user3487657
  • 553
  • 2
  • 8
  • 17
  • Finally with the Material Design support Library v 22.2.0 the FloatingActionButton is available. Check: http://stackoverflow.com/questions/30483210/is-there-a-native-component-for-the-floating-action-button-in-android-material-d/30527761#30527761 – Gabriele Mariotti Jun 05 '15 at 21:46

6 Answers6

10

You can now use the FloatingActionButton from the support-design library. Add this dependency to your gradle build file:

compile 'com.android.support:design:22.2.0'

And then add the FloatingActionButton to your layout file:

 <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        android:layout_margin="@dimen/fab_margin"
        android:src="@drawable/ic_done" />

Example project from Chris Banes: https://github.com/chrisbanes/cheesesquare.

makovkastar
  • 5,000
  • 2
  • 30
  • 50
7

I created an open-source library called FloatingActionButton. It's a Google+ like floating action button which reacts on the list view scrolling events. Becomes visible when the list view is scrolled up and invisible when scrolled down. API level 14+.

Demo

makovkastar
  • 5,000
  • 2
  • 30
  • 50
  • 1
    Consider making the 'floating action button' to do just that, float, over the content. You are breaking design guidelines by gluing it to the content below. No intents to bash your library, the fab looks great. – J.G.Sebring Dec 05 '14 at 08:08
  • 1
    You may just add it without attaching to the scrollable content. In this case the FAB will not react on scrolling events. – makovkastar Dec 05 '14 at 08:49
  • How can i use your library for Eclipse? @makovkastar – Pandiri Deepak Dec 11 '14 at 14:22
  • 1
    @PandiriDeepak you may add this library as a Maven or Gradle depedency. There are Maven and Gradle plugins exist for Eclipse as I know. – makovkastar Dec 14 '14 at 12:53
4

Here is one aditional free Floating Action Button library for Android It has many customizations and requires SDK version 9 and higher

enter image description here

Full Demo Video

dependencies {
    compile 'com.scalified:fab:1.1.2'
}
3

Original post is here.

You can use this library, it works well from the Android 2.1, API level 7.

It's so easy to include it in your project:

build.gradle

dependencies {
    compile 'com.shamanland:fab:0.0.6'
}

layout.xml

<com.shamanland.fab.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/your_image"
    />

image

Community
  • 1
  • 1
Oleksii K.
  • 5,359
  • 6
  • 44
  • 72
1

You can use this demo FloatingView. This demo work from API 11.

Here put all the parts necessary to implement by code. FloatingView by steps

joselufo
  • 3,393
  • 3
  • 23
  • 37
  • How do I make something like that : http://1.bp.blogspot.com/-Vv4SxVSI2DY/VEqQxAf3PWI/AAAAAAAAA7c/mfq7XBrIGgo/s400/activity_transitions%2B(1).gif (taken from here: http://android-developers.blogspot.co.il/2014/10/implementing-material-design-in-your.html ) ? does the support library have this feature somewhere? It's also called "Flexible space with image" : http://www.google.com/design/spec/patterns/scrolling-techniques.html#scrolling-techniques-scrolling – android developer Nov 18 '14 at 13:38
-1

Try this library, https://github.com/navasmdc/MaterialDesignLibrary

It can be easily to adapt to your project using Android Studio