Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robertlevonyan/custom-floating-action-button
This view is for replacement of standard Floating Action Button from Google Support Library. It is easy to use, customizable and you can also add text to button
https://github.com/robertlevonyan/custom-floating-action-button
android android-development android-library android-ui button floating-action-button floating-button floatingactionbutton floatingactionmenu floatingmenu gradle java material-design view
Last synced: 8 days ago
JSON representation
This view is for replacement of standard Floating Action Button from Google Support Library. It is easy to use, customizable and you can also add text to button
- Host: GitHub
- URL: https://github.com/robertlevonyan/custom-floating-action-button
- Owner: robertlevonyan
- License: apache-2.0
- Created: 2017-03-10T08:48:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-10-30T14:27:27.000Z (about 1 year ago)
- Last Synced: 2024-05-18T23:01:57.568Z (6 months ago)
- Topics: android, android-development, android-library, android-ui, button, floating-action-button, floating-button, floatingactionbutton, floatingactionmenu, floatingmenu, gradle, java, material-design, view
- Language: Kotlin
- Size: 1.26 MB
- Stars: 395
- Watchers: 9
- Forks: 52
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- Android-Awesome-Resources - Custom Floating Action Button:
README
# This library is no more supported!
# Custom Floating Action Button
|This view is for replacement of standard Floating Action Button from Google Support Library. It is easy to use, customizable and you can also add text to button||
|----------------------------------------------------------------------------------------------|-----------|[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Custom%20Floating%20Action%20Button-yellow.svg?style=flat-square)](https://android-arsenal.com/details/1/6570) [![API](https://img.shields.io/badge/API-17%2B-yellow.svg?style=flat-square)](https://android-arsenal.com/api?level=14) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.robertlevonyan.view/CustomFloatingActionButton/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.robertlevonyan.view/CustomFloatingActionButton)
## SetupAdd following line of code to your project level gradle file
```kotlin
repositories {
mavenCentral()
}
```#### Gradle:
Add following line of code to your module(app) level gradle file
```groovy
implementation 'com.robertlevonyan.view:CustomFloatingActionButton:'
```#### Kotlin:
```kotlin
implementation("com.robertlevonyan.view:CustomFloatingActionButton:$LATEST_VERSION")
```#### Maven:
```xml
com.robertlevonyan.view
CustomFloatingActionButton
LATEST_VERSION
pom
```## Usage
```xml
```|![](https://github.com/robertlevonyan/custom-floating-action-button/blob/master/Images/fab_circle_2.jpg)|![](https://github.com/robertlevonyan/custom-floating-action-button/blob/master/Images/fab_circle_text_2.jpg)|
|----------------------|-----------------------------------------------------------------------------------------|
|![](https://github.com/robertlevonyan/custom-floating-action-button/blob/master/Images/fab_rounded_square_2.jpg)|![](https://github.com/robertlevonyan/custom-floating-action-button/blob/master/Images/fab_rounded_square_text_2.jpg)|
|![](https://github.com/robertlevonyan/custom-floating-action-button/blob/master/Images/fab_square_2.jpg)|![](https://github.com/robertlevonyan/custom-floating-action-button/blob/master/Images/fab_square_text_2.jpg)|```xml
```|Circle layout |Rounded square layout |Square layout |
|---------------------------------------|----------------------------------------|--------------------------------------|
||||```xml
```
|Up |Down |Right |Left |
|----------------------------|-----------------------|------------------------------|-----------------------------|
|||||![](https://github.com/robertlevonyan/custom-floating-action-button/blob/master/Images/fl_expand_collapse_2.gif)
### Attributes
|Custom Atributes |Description |
|------------------------|-----------------------------------------------------------------------------------------|
|`app:fabType` |Visual style of Floating Action Button (values: circle (default), square, roundedSquare) |
|`app:fabSizes` |Sizes of Floating Action Button (values: normal (default), mini) |
|`app:fabElevation` |Change the elevation of view |
|`app:fabColor` |Custom color for Floating Action Button (default value is accent color) |
|`app:fabIcon` |Custom icon for Floating Action Button |
|`app:fabIconColor` |Custom color for icon |
|`app:fabRippleColor` |Custom ripple color for button |
|`app:fabIconPosition` |Icon position for icon (values: start (default), top, end, bottom) |
|`app:fabMenuStyle` |Animation style for items appearing (values: popUp (default), popDown, popRight, popLeft)|
|`android:gravity` |Gravity of menu and items |
|`app:fabAnimateMenu` |Flag to animate menu toggle |
|`app:fabAnimateDuration`|Flag to animate menu toggle |You can set a text and customize it using 'android' namespace like on a normal Button or TextView.
### Customizing from code
```kotlin
floatingActionButton.fabType = FabType.FAB_TYPE_CIRCLE /* Set button type FabType.FAB_TYPE_CIRCLE,
FabType.FAB_TYPE_SQUARE,
FabType.FAB_TYPE_ROUNDED_SQUARE */
floatingActionButton.fabSize = FabSize.FAB_SIZE_MINI /* Set button size FabSize.FAB_SIZE_NORMAL,
FabSize.FAB_SIZE_MINI */
floatingActionButton.fabElevation = 7f // Change elevation
floatingActionButton.fabColor = myFabColor // Change background color
floatingActionButton.fabIcon = myFabIconDrawable // Change icon
floatingActionButton.fabIconColor = myFabIconColor // Change icon color
floatingActionButton.fabRippleColor = myFabRippleColor // Change ripple color
floatingActionButton.fabIconPosition = FabIconPosition.FAB_ICON_START /* Change icon position
FabIconPosition.FAB_ICON_START,
FabIconPosition.FAB_ICON_TOP,
FabIconPosition.FAB_ICON_END,
FabIconPosition.FAB_ICON_BOTTOM */
``````kotlin
floatingActionLayout.fabType = FabType.FAB_TYPE_CIRCLE /* Set button type FabType.FAB_TYPE_CIRCLE,
FabType.FAB_TYPE_SQUARE,
FabType.FAB_TYPE_ROUNDED_SQUARE */
floatingActionLayout.fabElevation = 7f // Change elevation
floatingActionLayout.fabColor = myFabColor // Change background color
floatingActionButton.fabRippleColor = myFabRippleColor // Change ripple color
``````kotlin
floatingLayout.fabAnimationStyle = FabMenuAnimation.ANIMATION_POP_UP /* Set the pop animation of items
FabMenuAnimation.ANIMATION_POP_UP,
FabMenuAnimation.ANIMATION_POP_DOWN,
FabMenuAnimation.ANIMATION_POP_RIGHT,
FabMenuAnimation.ANIMATION_POP_LEFT */
```
### Setting Listeners```java
//Java
floatingLayout.setOnMenuExpandedListener(new FloatingLayout.OnMenuExpandedListener() {
@Override
public void onMenuExpanded() {
// Do stuff when expanded...
}@Override
public void onMenuCollapsed() {
// Do stuff when collapsed...
}
});
``````kotlin
//Kotlin
floatingLayout.doOnExpand {
// Do stuff when expanded...
}
floatingLayout.doOnCollapse {
// Do stuff when collapsed...
}
```
## Versions### 3.1.1 - 3.1.4
Update to Java 11
SDK 31 ready
Minor updates#### 3.1.0
Migration to mavenCentral
#### 3.0.1 - 3.0.6
Small updates
### 3.0.0
New version fully rewritten in Kotlin with several bugfixes
#### 2.1.0
Some bug fixing
### 2.0.0 - 2.0.4
Second version of library.
Totaly rewritten.
Added Floating action layout and Floating layout### 1.0.0 - 1.0.3
First version of library with some bugfixes
## Contact
- **Email**: [email protected]
- **Website**: https://robertlevonyan.com/
- **Medium**: https://medium.com/@RobertLevonyan
- **Twitter**: https://twitter.com/@RobertLevonyan
- **Facebook**: https://facebook.com/robert.levonyan
- **Google Play**: https://play.google.com/store/apps/dev?id=5477562049350283357## Licence
```
Custom Floating Action Button©
Copyright 2017 Robert Levonyan
Url: https://github.com/robertlevonyan/materialChipView
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 athttp://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.
```