Giter Site home page Giter Site logo

floatingactionbutton's Introduction

WARNING! FURTHER DEVELOPMENT AND SUPPORT IS DISCONTINUED.

FloatingActionButton

Maven Central Android Arsenal

Yet another implementation of Floating Action Button for Android with lots of features.

Requirements

The library requires Android API Level 14+.

Demo

Watch a short Demo Video on YouTube or try it using Android simulator in the browser on Appetize.io.
Sample APK can be found in Releases section.

Screenshots

Main screen Menu closed Menu default opened Menu custom opened Menu mini opened Menu right opened Menu down opened Progress background Progress no background

Features

  • Ripple effect on Android Lollipop devices
  • Option to set custom normal/pressed/ripple colors
  • Option to set custom shadow color and offsets
  • Option to disable shadow for buttons and (or) labels
  • Option to set custom animations
  • Option to set custom icon drawable
  • Support for normal 56dp and mini 40dp button sizes
  • Custom FloatingActionMenu icon animations
  • Option to expand menu up and down
  • Option to show labels to the left and to the right of the menu
  • Option to show circle progress on FloactinActionButton
  • Option to add button to the FloatingActionMenu programmatically
  • Option to dim the FloatinActionMenu's background
  • Option to remove all buttons from the FloatingActionMenu
  • Option to set a label for the FloatingActionMenu's button

Usage

Add a dependency to your build.gradle:

dependencies {
    compile 'com.github.clans:fab:1.6.4'
}

Add the com.github.clans.fab.FloatingActionButton to your layout XML file.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

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

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:layout_marginBottom="8dp"
        android:layout_marginRight="8dp"
        android:src="@drawable/ic_menu"
        fab:fab_colorNormal="@color/app_primary"
        fab:fab_colorPressed="@color/app_primary_pressed"
        fab:fab_colorRipple="@color/app_ripple"/>

</FrameLayout>

You can set an icon for the FloatingActionButton using android:src xml attribute. Use drawables of size 24dp as specified by guidlines. Icons of desired size can be generated with Android Asset Studio.

Floating action button

Here are all the FloatingActionButton's xml attributes with their default values which means that you don't have to set all of them:

<com.github.clans.fab.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:layout_marginBottom="8dp"
        android:layout_marginRight="8dp"
        android:src="@drawable/your_icon_drawable"
        app:fab_colorNormal="#DA4336"
        app:fab_colorPressed="#E75043"
        app:fab_colorRipple="#99FFFFFF"
        app:fab_showShadow="true"
        app:fab_shadowColor="#66000000"
        app:fab_shadowRadius="4dp"
        app:fab_shadowXOffset="1dp"
        app:fab_shadowYOffset="3dp"
        app:fab_size="normal"
        app:fab_showAnimation="@anim/fab_scale_up"
        app:fab_hideAnimation="@anim/fab_scale_down"
        app:fab_label=""
        app:fab_progress_color="#FF009688"
        app:fab_progress_backgroundColor="#4D000000"
        app:fab_progress_indeterminate="false"
        app:fab_progress_max="100"
        app:fab_progress="0"
        app:fab_progress_showBackground="true"/>

All of these FloatingActionButton's attributes has their corresponding getters and setters. So you can set them programmatically.

Floating action menu

Here are all the FloatingActionMenu's xml attributes with their default values which means that you don't have to set all of them:

<com.github.clans.fab.FloatingActionMenu
        android:id="@+id/menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginRight="10dp"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="10dp"
        fab:menu_fab_size="normal"
        fab:menu_showShadow="true"
        fab:menu_shadowColor="#66000000"
        fab:menu_shadowRadius="4dp"
        fab:menu_shadowXOffset="1dp"
        fab:menu_shadowYOffset="3dp"
        fab:menu_colorNormal="#DA4336"
        fab:menu_colorPressed="#E75043"
        fab:menu_colorRipple="#99FFFFFF"
        fab:menu_animationDelayPerItem="50"
        fab:menu_icon="@drawable/fab_add"
        fab:menu_buttonSpacing="0dp"
        fab:menu_labels_margin="0dp"
        fab:menu_labels_showAnimation="@anim/fab_slide_in_from_right"
        fab:menu_labels_hideAnimation="@anim/fab_slide_out_to_right"
        fab:menu_labels_paddingTop="4dp"
        fab:menu_labels_paddingRight="8dp"
        fab:menu_labels_paddingBottom="4dp"
        fab:menu_labels_paddingLeft="8dp"
        fab:menu_labels_padding="8dp"
        fab:menu_labels_textColor="#FFFFFF"
        fab:menu_labels_textSize="14sp"
        fab:menu_labels_cornerRadius="3dp"
        fab:menu_labels_colorNormal="#333333"
        fab:menu_labels_colorPressed="#444444"
        fab:menu_labels_colorRipple="#66FFFFFF"
        fab:menu_labels_showShadow="true"
        fab:menu_labels_singleLine="false"
        fab:menu_labels_ellipsize="none"
        fab:menu_labels_maxLines="-1"
        fab:menu_labels_style="@style/YourCustomLabelsStyle"
        fab:menu_labels_position="left"
        fab:menu_openDirection="up"
        fab:menu_backgroundColor="@android:color/transparent"
        fab:menu_fab_label="your_label_here"
        fab:menu_fab_show_animation="@anim/my_show_animation"
        fab:menu_fab_hide_animation="@anim/my_hide_animation">

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/menu_item"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_star"
            fab:fab_size="mini"
            fab:fab_label="Menu item 1" />

    </com.github.clans.fab.FloatingActionMenu>

If you're using custom style for labels - other labels attributes will be ignored.

Labels shadow preferences depends on their corresponding FloatingActionButtons' shadow preferences.

For more usage examples check the sample project.

Changelog

Please see the Changelog page to see what's recently changed.

Credits

I used android-floating-action-button library by Jerzy Chalupski as a base for development.

License

Copyright 2015 Dmytro Tarianyk

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

floatingactionbutton's People

Contributors

anothem avatar clans avatar cziemba avatar jzeferino avatar rgabrysiak avatar zsoltk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

floatingactionbutton's Issues

setting ImageDrawable as android-iconify's IconDrawable

Hello,
I'm using android-iconify for setting floating action button's drawable. However, when I set the ImageDrawable as IconDrawable the following occurs;

mNewEventButton.setImageDrawable(new IconDrawable(mContext, Iconify.IconValue.fa_calendar).colorRes(R.color.white).actionBarSize());
mNewMessageButton.setImageDrawable(new IconDrawable(mContext, Iconify.IconValue.fa_envelope).colorRes(R.color.white).actionBarSize());

floating_action_button_bug

NOTE: I've tried decrementing icon size and setting padding of button to 0. It doesn't work

Is there any way to fix this?

Background issues while using colorRipple

Background issues while using custom pressed and ripple colors.

This is my FAB layout:
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@drawable/ic_add_white_24dp"
fab:fab_colorNormal="@color/theme_accent"
fab:fab_colorPressed="@color/theme_accent_pressed"
fab:fab_colorRipple="@color/theme_accent_ripple" />

issue-fab1

Tested on Nexus 6 (Android 5.1).

When I remove colorPressed and colorRipple strange rectangles are gone.

Can't set label with icon

I'm trying to add label near button. It works on Android 5.0 perfectly but older versions give error.

<com.github.clans.fab.FloatingActionButton
android:id="@+id/button_view_wall"
style="@style/MenuButtonsStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_tooltip_text_grey600_24dp"
fab:fab_label="@string/profile_action_view_wall" />

Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f02003b a=-1 r=0x7f02003b}

How to add FAB buttons programatically?

Hi,
I need to add or remove the FAB buttons programmatically, so I've added the menu in the XML file and then i tried to add the FloatingActionButtons programmatically with calling addView method on the menu.
The problem is that the menu does't show the new fab buttons because the children have created on onMeasure. I tried to call the requestLayout() method on the menu but nothing changed.
How can i handle it ?

Crashed on FloatingActionButton$ProgressSavedState

A random crash appears when I open my app and my MainActivity calls it's child fragment with

fragment.onCreate(savedInstanceSave)

Here is the full stack of the crash:

java.lang.RuntimeException: Unable to start activity ComponentInfo{activities.MainActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.github.clans.fab.FloatingActionButton$ProgressSavedState
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
       at android.app.ActivityThread.access$800(ActivityThread.java:151)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5254)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.github.clans.fab.FloatingActionButton$ProgressSavedState
       at android.os.Parcel.readParcelableCreator(Parcel.java:2295)
       at android.os.Parcel.readParcelable(Parcel.java:2245)
       at android.os.Parcel.readValue(Parcel.java:2152)
       at android.os.Parcel.readSparseArrayInternal(Parcel.java:2546)
       at android.os.Parcel.readSparseArray(Parcel.java:1874)
       at android.os.Parcel.readValue(Parcel.java:2209)
       at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
       at android.os.BaseBundle.unparcel(BaseBundle.java:221)
       at android.os.Bundle.getBundle(Bundle.java:733)
       at com.google.android.gms.maps.internal.cv.a(SourceFile:74)
       at com.google.maps.api.android.lib6.d.ft.a()
       at com.google.maps.api.android.lib6.d.ap.a()
       at com.google.android.gms.maps.internal.aa.onTransact(SourceFile:66)
       at android.os.Binder.transact(Binder.java:380)
       at com.google.android.gms.maps.internal.IMapViewDelegate$zza$zza.onCreate()
       at com.google.android.gms.maps.MapView$zza.onCreate()
       at com.google.android.gms.dynamic.zza$3.zzb()
       at com.google.android.gms.dynamic.zza$1.zza()
       at com.google.android.gms.maps.MapView$zzb.zztD()
       at com.google.android.gms.maps.MapView$zzb.zza()
       at com.google.android.gms.dynamic.zza.zza()
       at com.google.android.gms.dynamic.zza.onCreate()
       at com.google.android.gms.maps.MapView.onCreate()
       at fragements.MapFragment.onCreateView(MapFragment.java:200)
       at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1120)
       at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1929)
       at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547)
       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236)
       at android.app.Activity.performStart(Activity.java:6006)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
       at android.app.ActivityThread.access$800(ActivityThread.java:151)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5254)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Is anyone experiencing this also?

Thanks!

Hi,

No issue here. Just dropping a note to say I used your library in this project:
https://github.com/doc-rj/smartcard-reader

Without much trouble, I was able to make it look and feel like the Google Keep menu experience.

Thanks for the great work. I plan to add a thanks/credits section to my README soon.

Thanks,
-- Ryan

Click On FloatingActionButton Falls Through to RecyclerView Item

I'm trying to utilize your library (thank you, BTW) to create a floating action button to initialize adding items to a RecyclerView. The floating action button does show up on the screen above the RecyclerView in the bottom right. However, clicking on the button causes a ripple effect on the RecyclerView item beneath the button and causes the item view activity to launch. It's as if the floating action button does not exist on the screen, even though it is clearly seen. I had a similar issue with the option list in my Navigation Drawer and resolved it by adding android:clickable="true" to the layout resource file. However, that does not seem to be helping in this case. Below is my layout XML file. Do you see anything that would cause an issue with the FloatingActionButton library?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/person_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical" />

    <com.github.clans.fab.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_marginBottom="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginEnd="8dp"
        android:src="@drawable/fab_add"
        android:clickable="true"
        fab:fab_colorNormal="@color/colorAccent"
        fab:fab_colorPressed="@color/colorAccentDark" />

</RelativeLayout>

When menu is collapsed menu items still take space

I'm guessing it's because it uses visibility=invisible instead of setting it to gone.
I'm not totally sure why this design choice was made, but it would be much cleaner if there was a parameter instead for making certain buttons not appearing when menu is opened.

fab:active="true|false"

This way space wouldn't be cluttered with invisible buttons and they wouldn't affect layout around them.

API 14+

I like you library but in many projects we use at the moment API 14+. Could you tell me why you choose for this library 15+? Any chances for this lib to be 14+?

removeButton from Menu

Sorry, i don't understand how to remove all button from menu programmatically.
How i can I access to buttons "children" of menu?

ty

Adding an option to display FloatingMenu at the bottom of the FAB and not at the top.

I haven't seen any mention of this case in the guidelines, or in a Google app, but would be nice if the menu could open at the bottom of the primary FAB.

In some cases, the FAB is in the upper part of the screen , and the Menu items needs to be below, which is I think not supported by your lib (yet?)

Will try to find an exemple or a picture and add it here, but I hope you understand what I mean.

Thanks for your work!

Button color icon different from the real color

Hi,

I implement the first xml button example and the icon color into the button is different (gray) to the real icon color (white). I tried using a black icon but with the same result.

Thanks,

issue on animation files.

after importing library on eclipse, all animations files in anim folder, showing error on "android:interpolator="@android:interpolator/........".

what should i do for solving this.?

Add the possibility to show the progress circle on the FloatingActionMenu

Currently, the progress circle is only available on the FloatingActionButton, but I can see it useful on FloatingActionMenu, for replacing the main progress view used on the fragments, so it could show a load in progress during the first content load or a pushed update...

Anyway, this is a feature request.

Thank you for your work.

Setting colorfilter on icon on fab

I was curious if there was a way to set the color filter on a drawable on the fab.

I see a protected function getIconDrawable but like i said it is protected so im not able to use it. and get drawable returns null. I was just curious if there was any way to get it so I can update the filter.

Ripple Effect/Pressed Effect Not Working

Hi!

Thanks for the great library, but when I implemented it and tested it out, the color does not change when clicked nor does the ripple effect show.

I added the Grade dependency and then added the floating action button to the activity_main.xml. Do I need to add Java code to make the ripple effect and the pressed effect to work?

Sorry if my mistake is very basic. Still a beginner to Android :)
Thank you so much for your help and thanks again for the amazing library!

This is the xml that I have for the FAB.

 <com.github.clans.fab.FloatingActionButton
         android:id="@+id/fab"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         android:layout_alignParentRight="true"
         android:src="@drawable/fab_plus_icon"
         fab:fab_colorNormal="@color/fab_material_red_500"
         fab:fab_colorPressed="@color/fab_material_red_900"
         fab:fab_colorRipple="#D32F2F"
         fab:fab_size="normal"
         fab:fab_elevationCompat="4dp"
         />

Api 9

Hi,

Would it be possible to make the library compatible with API 9?
Maybe using NineOldAndroids for animation (I dind't look at the source code)?

Thanks in advance

BackgroundColor in Code ?

Hi,

first of all very nice work 👍 , but I have a question.
How can I set the BackgroudColor of the Menu (and the Button) in Code ?
I have tried everything and have also seen the sample project, but got no solution.
I have to change the color based on the current image!

-> mFloatingActionMenu.setBackgroundColor(palette.getVibrantColor(0x00000));

This statement gives not the wanted effect
quickmemo _2015-04-06-22-26-33
https://www.dropbox.com/s/za13sexhmmynkiw/QuickMemo%2B_2015-04-06-22-26-33.png?dl=0

Need Help

fab:menu_openDirection="up" - ERROR

Very nice library, thanks.
But when I add
fab:menu_openDirection="up"
to XML layout definition, an error occurs
Error:(25) No resource identifier found for attribute 'menu_openDirection' in package ....

I would like open menu from right to left
Can you help me please?

Issue with layout and centering multiple buttons

I'm using the example project and am having a bit of issue trying to center the buttons in the floating_menus_activit.xml

I've wrapped the menus in a RelativeLayout:

http://screencloud.net/v/neqg

but the result doesn't really look good (only one of the buttons has been aligned center), even after specifying layout_centerHorizontal

http://screencloud.net/v/lVXF

Here's my xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="102dp"
        android:text="@string/lorem_ipsum"
        android:maxLines="3"
        android:ellipsize="end"
        android:textColor="@android:color/white"
        android:textSize="22sp"
        android:paddingTop="8dp"
        android:paddingRight="8dp"
        android:paddingLeft="60dp"
        android:fontFamily="sans-serif-light"
        android:background="@color/app_primary"/>

    <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:layout_centerHorizontal="true"
            android:layout_alignParentTop="false" android:gravity="right">
        <com.github.clans.fab.FloatingActionMenu
            android:id="@+id/menu1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fab:menu_labels_ellipsize="end"
            fab:menu_labels_singleLine="true" android:layout_centerHorizontal="true">

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_size="mini"
                fab:fab_label="Menu item 1" />

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_size="mini"
                fab:fab_label="Menu item 2" />

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_size="mini"
                fab:fab_label="@string/lorem_ipsum" />

        </com.github.clans.fab.FloatingActionMenu>
        <com.github.clans.fab.FloatingActionMenu
            android:id="@+id/menu2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="false"
            fab:menu_labels_style="@style/MenuLabelsStyle"
            fab:menu_labels_showAnimation="@anim/jump_from_down"
            fab:menu_labels_hideAnimation="@anim/jump_to_down"
            fab:menu_animationDelayPerItem="0"
            fab:menu_shadowColor="#444"
            fab:menu_colorNormal="#FFB805"
            fab:menu_colorPressed="#F2AB00"
            fab:menu_colorRipple="#D99200"
            android:layout_centerHorizontal="true">

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_label="Menu item 1"
                style="@style/MenuButtonsStyle" />

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab22"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_label="Menu item 2"
                style="@style/MenuButtonsStyle" />

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab32"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_label="@string/lorem_ipsum"
                style="@style/MenuButtonsStyle" />

        </com.github.clans.fab.FloatingActionMenu>
        <com.github.clans.fab.FloatingActionMenu
            android:id="@+id/menu3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fab:menu_colorNormal="#1565C0"
            fab:menu_colorPressed="#2272CD"
            fab:menu_colorRipple="#62B2FF"
            android:layout_centerHorizontal="true">

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab13"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_star"
                style="@style/MenuButtonsSmall" />

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab23"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_star"
                style="@style/MenuButtonsSmall" />

            <com.github.clans.fab.FloatingActionButton
                android:id="@+id/fab33"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_star"
                style="@style/MenuButtonsSmall" />

        </com.github.clans.fab.FloatingActionMenu>
        <com.github.clans.fab.FloatingActionMenu
            android:id="@+id/menu4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            fab:menu_icon="@drawable/ic_star"
            fab:menu_animationDelayPerItem="0"
            fab:menu_colorNormal="#43A047"
            fab:menu_colorPressed="#2E7D32"
            fab:menu_colorRipple="#1B5E20"
            fab:menu_labels_maxLines="2"
            fab:menu_labels_ellipsize="end" android:layout_centerHorizontal="true">

            <com.github.clans.fab.FloatingActionButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_label="Menu item 1"
                style="@style/MenuButtonsSmall.Green" />

            <com.github.clans.fab.FloatingActionButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_label="Menu item 2"
                style="@style/MenuButtonsSmall.Green" />

            <com.github.clans.fab.FloatingActionButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_edit"
                fab:fab_label="@string/lorem_ipsum"
                style="@style/MenuButtonsSmall.Green" />

        </com.github.clans.fab.FloatingActionMenu>
    </RelativeLayout>

</RelativeLayout>

aapt.exe failure

Hello,

When I try to add your library to my project, I'm unable to build it. I have aapt failures :

:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
D:\Env\android\sdk\build-tools\20.0.0\aapt.exe package -f --no-crunch -I D:\Env\android\sdk\platforms\android-21\android.jar -M D:\Sources\my-app\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\Sources\my-app\app\build\intermediates\res\debug -A D:\Sources\my-app\app\build\intermediates\assets\debug -m -J D:\Sources\my-app\app\build\generated\source\r\debug -F D:\Sources\my-app\app\build\intermediates\res\resources-debug.ap_ --debug-mode --custom-package me.myapp.android -0 apk --output-text-symbols D:\Sources\my-app\app\build\intermediates\symbols\debug
Error Code:
-1073741819


* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
...

Caused by: com.android.ide.common.internal.LoggedErrorException: Failed to run command:
D:\Env\android\sdk\build-tools\20.0.0\aapt.exe package -f --no-crunch -I D:\Env\android\sdk\platforms\android-21\android.jar -M D:\Sources\my-app\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\Sources\my-app\app\build\intermediates\res\debug -A D:\Sources\my-app\app\build\intermediates\assets\debug -m -J D:\Sources\my-app\app\build\generated\source\r\debug -F D:\Sources\my-app\app\build\intermediates\res\resources-debug.ap_ --debug-mode --custom-package me.myapp.android -0 apk --output-text-symbols D:\Sources\my-app\app\build\intermediates\symbols\debug
Error Code:
-1073741819

at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:123)
at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:96)
at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:76)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:738)
at com.android.builder.core.AndroidBuilder$processResources$2.call(Unknown Source)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.groovy:120)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.groovy:64)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
... 63 more

Running the same command manually cause 'appt.exe has stopped working'

Status

Hi!
How do I know the status menu of the currently open or closed?

Fab click behavior enhancement.

Hi!
I think you should specify that if the FAB doesn't have an OnClickListener, it won't even respond and the view under it will be clicked, leading to 'think' it's a bug, because it doesn't change its state to pressed.

For example: I put a FAB with a RecyclerView, and if I don't set an OnClickListener, the row under the button can be pressed. In my case, just for test how it behaves.

Maybe a default empty OnClickListener on the FAB would help! Thanks!

FAB labels are gone after switching the tab.

I have placed 3 FABS (in FabMenu) with labels in a tab view (middle tab of 3 tab pages). If I open the FabMenu, swipe to another tab and after that swipe back to the screen with the FABS then the open FabMenu with the 3 FABS is stll there (as expected) but the labels are gone. After clicking the FabMenu button to close the Menu the labels are suddenly been shown and the menu closes.
It seems to me that the FAB-Labels are cleared in this moment the tab view is redrawn (after swiping back)!? Any ideas?

FloatingActionButton elevation

I'm facing this issue when I put elevation to any view the floatingactionbutton always appear under that view no matter what I do.

  • Without Elevation
    screen shot 2015-04-09 at 8 35 18 am
  • With Elevation
    screen shot 2015-04-09 at 8 36 11 am

setEnable not work properly

Hi, if you use setEnable(false) on fab the button becomes not clickable but every time you click, it changes color like when it's enable.
Could be useful to be able to set also the color for disabled status.

Regards,

Simone

FloatingActionMenu does not expand

I have a FloatingActionMenu in a Fragment. In some cases, the menu does not expand. Typically causing this fragment to be recreated resolves the issue.

For what it's worth, the OnClick listeners for the FloatingActionButtons inside the FloatingActionMenu always trigger reliably once the menu is showing.

Any tips on how to troubleshoot this?

Unable to set labels to appear to the right of button

The floating action menu assumes that the button will be placed on the right hand side of the screen, so the labels will appear to the left of the menu buttons.

I want to be able to place my menu button on the far left side of the screen and still have the ability to have labels show up, which means showing them on the right side of the buttons.

Is there currently a way to do this? I tried setting the label margin to be negative, but it unfortunately cuts off the label

Error: Could not find class

I use this library in my App, App is running OK, but I got this error log:

05-26 11:39:47.330  30816-30816/com.addict.easynotes E/dalvikvm﹕ Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method com.github.clans.fab.FloatingActionButton.createFillDrawable
05-26 11:39:47.340  30816-30816/com.addict.easynotes E/dalvikvm﹕ Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method com.github.clans.fab.FloatingActionButton.onActionDown
05-26 11:39:47.340  30816-30816/com.addict.easynotes E/dalvikvm﹕ Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method com.github.clans.fab.FloatingActionButton.onActionUp

Support for AddMenuButton at index

Hey,
Thank you so much for your library. Its Awesome. Just wanted to request for a feature where user can choose the index at which he wants to add FAB. Basically I have a use-case similar to Inbox, 1 FAM and few xml defined FAB inside it, and few programmatically added at runtime. Now the newly added FAB always appear at the bottom. But I wanted them to appear above my pre-defined FABs.

Proguard settings?

Hey there. Could you please provide some info on how to set Proguard?

Custom TypeFace

Hi,

It would be awesome if we could set a custom TypeFace programmatically.

Thanks.

Delay time tips

Please create delay time tips.
And another bug: when you press on the menu reappear tips on menu items.

ActionMenu pressed but not expanding bug

I found a bug while developing the app using FloatingActionButton library. Following images are screenshots of what happened.

not_pressed
The above color of image is when my FloatingActionMenu is not pressed.

pressed
The above image is when the ripple effect happened in FloatingActionMenu.

The thing happened is when I scroll at the very top of the FloatingActionMenu, the ripple effect occurs FloatingActionMenu (and I think it's actually pressed) but FloatingActionMenu does not appear. I used FloatingActionMenu with the recycler view.

To sum up, Floating Action Menu sometimes does not expand when I clicked in a little bit odd way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.