I need to implement a floating action button, according to Google Design Guidelines, on my android application with API level 19.
However, I would know if some native support library (like v4, v7, v13) to help me build this component without the need for external dependencies.
Add the floating action button to your layoutThe size of the FAB, using the app:fabSize attribute or the setSize() method. The ripple color of the FAB, using the app:rippleColor attribute or the setRippleColor() method. The FAB icon, using the android:src attribute or the setImageDrawable() method.
I would know if some native support library (like v4, v7, v13) to help me build this component without the need for external dependencies.
No there aren't any support library floating action buttons (FAB). IMHO, it's a horrible decision to not include all of the material related widgets in the support library. In this video Chet Haase and Adam Powell basically say that the FAB is very easy to reproduce so they're not going to include it in any support library. So instead of Google creating one set of the material widgets to be used by millions of developers they would rather millions of developers create millions of different implementation of these widgets. </rant>
You can just make your own FAB by extending the View
class. Here is an example from Github of a FAB that does not use any outside libraries.
Recently Google has released a new support library based on Material Design Guideline. The Codepath details the same components in this post.
The library can be already used with Gradle adding the following line in build.gradle:
dependencies {
...
compile 'com.android.support:design:25.3.1'
}
This is a simple example of usage:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_add"
android:layout_gravity="bottom|end" />
See more FloatingActionButton example with Support Library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With