zendesk / android-floating-action-button Goto Github PK
View Code? Open in Web Editor NEWFloating Action Button for Android based on Material Design specification
License: Apache License 2.0
Floating Action Button for Android based on Material Design specification
License: Apache License 2.0
Maybe I'm just slow, but things function well, but what is the intended pattern for handling a button press? onCLick handler didn't do it...
How to implement floating menu correctly. Sometimes,, when I add view, it never expands by clicking. onClickListener doesnt work.
Sometimes when it works, it align itself so as to fit the view that i added. I have arranged button at parent right by default. I comes to somewhere around center. i tried adding direction to view from right to left, but with no success.
Expose mExpanded from FloatingActionsMenu via isExpanded.
This is required to findout the current state of floatingactionsmenu, normal pattern is to close the actionsmenu when back button is expanded or else exit the activity.
When the floating menu is opened, Is it possible to show the background shadow to disable background click event like inbox?
Is there a way to change the plus icon on clicking in the floating actions menu?..and bringing it back to the original state on clicking anywhere else in the screen?
Just like the inbox app??
I set icon for ActionButton but the icon not centred
Create setXXXX() methods to enable size, colors, etc
Hi.
I've just made an unofficial fork for setting a drawable at the menu fab.
The code is pure crap (i never worked with canvas before), but maybe you like to take a look and include this feature in your code in the future.
Change FAB state when click.
Allow icon to animate, like AddFAB to change into loading, etc.
Enable 'enabled' state
I'm trying to put a TextView next to a FloatingActionButton. But the width of FloatingActionMenu not allows it to fit the two, using match_parent or by setting in hand widh also is not working. Any suggestions for how I can do this?
Exemple:
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
app:fab_addButtonColorNormal="@color/white"
app:fab_addButtonColorPressed="@color/primary_button_pressed_color"
app:fab_addButtonPlusIconColor="?attr/colorPrimary">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:text="Teste" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
app:fab_colorNormal="@color/white"
app:fab_colorPressed="@color/primary_button_pressed_color"
app:fab_size="mini" />
</FrameLayout>
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_colorNormal="@color/white"
app:fab_colorPressed="@color/primary_button_pressed_color"
app:fab_size="mini" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_colorNormal="@color/white"
app:fab_colorPressed="@color/primary_button_pressed_color"
app:fab_size="mini" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/floating_action_button_diary_my_items_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_colorNormal="@color/white"
app:fab_colorPressed="@color/primary_button_pressed_color"
app:fab_size="mini" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_colorNormal="@color/white"
app:fab_colorPressed="@color/primary_button_pressed_color"
app:fab_size="mini" />
</com.getbase.floatingactionbutton.FloatingActionsMenu>
Using a background color with some alpha (e.g. #99fe0038
) when the shadow is set to true reveals two circles: one for the floating action button and another inside (cf. image below). The latter is probably caused by the shape of the drawable that is used for creating the shadow.
It would be nice to get a circle without the inner one when a transparent background color is used.
I have also noticed that the image drawable used for the shadow isn't provided for xxxhdpi
.
I'm using version 1.10 right now. I noticed there are some OutOfMemoryError on crashlytics for some time.
I checked the release notes, It seems it wasn't fixed yet. So I post an issue here.
I thinks this is the same problem from this issue:
alexvasilkov/FoldableLayout#10
Here is the trace:
Caused by: java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreate(Bitmap.java)
at android.graphics.Bitmap.createBitmap(Bitmap.java:929)
at android.graphics.Bitmap.createBitmap(Bitmap.java:902)
at android.graphics.Bitmap.createBitmap(Bitmap.java:869)
at com.getbase.floatingactionbutton.FloatingActionButton.createStrokesDrawable(FloatingActionButton.java:164)
at com.getbase.floatingactionbutton.FloatingActionButton.updateBackground(FloatingActionButton.java:112)
at com.getbase.floatingactionbutton.FloatingActionButton.init(FloatingActionButton.java:75)
at com.getbase.floatingactionbutton.FloatingActionButton.(FloatingActionButton.java:53)
Hi, I need to use this in an Eclipse project, is it possible? Thanks.
Is there a way to move up the action button in order to be above the snack bar?
I am using this snackbar: https://github.com/nispok/snackbar
Sample code issue?
FloatingActionButton button = (FloatingActionButton) findViewById(R.id.setter);
button.setSize(FloatingActionButton.SIZE_MINI);
Android Studio complains that button.setSize value must be 0 or 1
Help?
I try to use it the way shown in the sample app, but there's no such a method in FloatingActionsMenu class. How do I set up the buttons?
buttonA = new FloatingActionButton(activity.getBaseContext());
buttonB = new FloatingActionButton(activity.getBaseContext());
fam = (FloatingActionsMenu) fragmentLayout.findViewById(R.id.menu);
fam.addButton(buttonA);
fam.addButton(buttonB);
buttonA .setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
methodA();
}
});
buttonB .setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
methodB();
}
});
Unable to set typeface to floatingActionButton view. I am trying to use fontawesome icons for each floatingActionButton. For now, i am using app:fab_icon to set the icon from the drawables folder. But, would like use fontAwesome Icons. Please show me a way.
Hi!
I created some widgets that automtically place the FAB button in the correct place like guidlines say.
I will fork your project and try to PR if you think that are cool to setup in project.!
:)
Would be nice to be able to customize the icon from the actionmenu base button. :)
It would be a nice feature if you allow us to set the orientation of FloatingActionsMenu to other directions; as of now its child would always expand upward.
fab_addButtonColorNormal
fab_addButtonColorPressed
fab_addButtonPlusIconColor
Please fix it...It's important for me !!!
I have an app that has minSdkVersion 9
, and I cannot use this library with it because minSdkVersion
is currently set to 14. But I have manually built the library myself and have not found any problems. Is there a reason for only supporting API 14 and above? If not, could minSdkVersion
be lowered?
Can I do it like this:
FloatingActionsMenu fam = (FloatingActionsMenu)findViewById(R.id.multiple_actions);
FloatingActionButton fab = new FloatingActionButton(getBaseContext());
fam.addView(fab);
But there's nothing wrong,it's not print anything
I had need to add a scrim to the display when the Menu was open. As there wasn't anything setup for it in the code, I extended FloatingActionsMenu with the following code. That way I could optionally add an event listener in my activity for toggling the scrim.
I don't know if this is the best way to do things which is why I'm submitting an issue instead of a pull request...
import android.content.Context;
public class FloatingActionsMenu extends com.getbase.floatingactionbutton.FloatingActionsMenu {
private OnFloatingActionMenuUpdateListener onFloatingActionMenuUpdateListener;
public FloatingActionsMenu( Context context ) {
this( context, null );
}
public void setOnFloatingActionMenuUpdateListener( OnFloatingActionMenuUpdateListener listener ) {
onFloatingActionMenuUpdateListener = listener;
}
@Override
public void toggle() {
super.toggle();
if( onFloatingActionMenuUpdateListener != null ) {
onFloatingActionMenuUpdateListener.actionMenuToggled();
}
}
public interface OnFloatingActionMenuUpdateListener {
public void actionMenuToggled();
}
}
The version that @makovkastar made has an attachToListView
method for the floating action button. I don't see a method similar on FloatingActionsMenu
. Am I not seeing something or was the auto hide on scroll feature deleted?
These configs should be added to proguard, else FloatingActionsMenu's + to x animation will not work
-keep class com.getbase.floatingactionbutton.** { *; }
Might require additional work in FloatingActionsMenu.
I'm trying to make menu similar to the one Inbox app has. There is a large floating button which opens a menu of mini action button, but they are horizontally centered. I can't set gravity to FloatingActionsMenu since it's a ViewGroup.
I've noticed a 'white glow' on the top side of the FAB (See attached).
I'm not exactly sure what the createStrokesDrawable
method does (drawable stuff isn't my forte), but I was trying to work out what was causing the 'white glow', and sure enough, out-commenting the following fixed it:
// inner top
paint.setShader(new LinearGradient(innerStrokeRect.centerX(), innerStrokeRect.top, innerStrokeRect.centerX(), innerStrokeRect.bottom,
new int[]{Color.WHITE, HALF_TRANSPARENT_WHITE, Color.TRANSPARENT},
new float[]{0f, 0.2f, 1f},
TileMode.CLAMP
));
In my opinion, removing the 'inner top' stroke would be an enhancement.
So, on the left is the standard, untouched FAB. On the right is the FAB generated with the 'inner top' commented out.
Hi, I am new to using external libraries. I'm using Android Studio but I'm having a real difficult time adding an external library to my app. I've following the instructions here but it is just not working. Can you please provide me with a step by step guide for installing?
I'm getting ~trunk/build.gradle failed to find: com.getbase:floatingactionbutton:1.1.0
Thanks, Eric
I try call expande() when start activity and i get error NullPointerException. What wrong in here?
When i add this library to my project, i got an aapt error.
"Error:Attribute "icon" has already been defined"
This is only if i use AppCompat.
Can you add the option to set background drawable?
It can be useful when you need to disable the button, with current state it just has 'colorNormal'.
Is it Supported in 2.2 version..?
I need it badly in for backword compatibility..!!!
Suppose you want to add 10 FloatingActionButtons in the screen, some of them will not be shown, it would be nice to be able to scroll the FloatingActionButtons when the FloatingActionMenu is expanded, or set a grid of how the FloatingActionButton are positioned, like 4 lines of buttons.
Thanks
Thanks a lot
I added the dependency line into my existing project graddle build file on Android Studio beta 0.8.14
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:21.0.+"
compile 'com.getbase:floatingactionbutton:1.2.0'
}
and I got this error when build. Note that I haven't even added any codes. What could I be doing wrong?
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\vnguyen5\android-sdks\build-tools\20.0.0\aapt.exe package -f --no-crunch -I C:\Users\vnguyen5\android-sdks\platforms\android-21\android.jar -M D:\dev\MyTestApplication\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\dev\MyTestApplication\app\build\intermediates\res\debug -A D:\dev\MyTestApplication\app\build\intermediates\assets\debug -m -J D:\dev\MyTestApplication\app\build\generated\source\r\debug -F D:\dev\MyTestApplication\app\build\intermediates\res\resources-debug.ap_ --debug-mode --custom-package com.vnguyen.mytestapplication -0 apk --output-text-symbols D:\dev\MyTestApplication\app\build\intermediates\symbols\debug
Error Code:
-1073741819
Hi, i have implemented your library in pre honeycomb devices using nineoldandroids.
Works Great...
Here is my gist
i have kept your code commented.
There is an issue with Maven Central, the library can't be found on it via Gradle.
Even if it seems to be there
The FloatingActionsMenu should collapse when the user clicks/touches a different view similar to how the Inbox by Gmail FloatingActionsMenu auto-collapses when it loses focus.
Is it possible? I tried to look but didn't find any methods but maybe it was called differently? I know we could set it in the XML but it'd be nice if we could do it in the code as well..
What I'm trying to do: is to switch the direction if the device orientation changed!
Thanks.
For API 21 and above (Lollipop), please set the floating button to also have the ripple effect and optionally other effects (like a real shadow instead of drawable).
I am getting this when trying to compile with fab_expandDirecton. I am using the gradle build.
Hi,
Is the minSdkVersion 14?
Any reason for that?
Miguel
Below code give me unaligned buttons, if make all the buttons as normal buttons are aligned
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:id="@+id/fab_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_addButtonColorNormal="@color/fab_normal"
fab:fab_addButtonColorPressed="@color/fab_pressed"
fab:fab_addButtonPlusIconColor="@color/white"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="bottom|right|center">
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/colorAccent"
fab:fab_colorPressed="@color/colorPrimaryDark"
fab:fab_icon="@drawable/ic_expand_less"
fab:fab_size="mini"
/>
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_manual"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/colorAccent"
fab:fab_colorPressed="@color/colorPrimaryDark"
fab:fab_icon="@drawable/ic_keyboard"
fab:fab_size="mini" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/colorAccent"
fab:fab_colorPressed="@color/colorPrimaryDark"
fab:fab_icon="@drawable/ic_photo_camera"
fab:fab_size="mini"
/>
</com.getbase.floatingactionbutton.FloatingActionsMenu>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.