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 |
---|
Add following line of code to your module(app) level gradle file
implementation 'com.robertlevonyan.view:CustomFloatingActionButton:2.1.1'
<dependency>
<groupId>com.robertlevonyan.view</groupId>
<artifactId>CustomFloatingActionButton</artifactId>
<version>2.0.5</version>
<type>pom</type>
</dependency>
<com.robertlevonyan.views.customfloatingactionbutton.FloatingActionButton
android:id="@+id/custom_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end" />
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionLayout
android:id="@+id/customFABL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<!--Add any layout here-->
</com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionLayout>
Circle layout | Rounded square layout | Square layout |
---|---|---|
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingLayout
android:id="@+id/floating_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--
Add here only
com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
or android.support.design.widget.FloatingActionButton,
other views will be neglected by the layout
-->
<!--Top view will be selected as a toggle for menu-->
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
... />
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
... />
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
... />
<com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingActionButton
... />
<android.support.design.widget.FloatingActionButton
... />
</com.robertlevonyan.examples.customfloatingactionbutton.view.FloatingLayout>
Up | Down | Right | Left |
---|---|---|---|
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:fabText |
Text label of Floating Action Button |
app:fabTextAllCaps |
Set text label all capitals |
app:fabTextColor |
Set custom color for text label |
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) |
app:fabMenuGravity |
Gravity of menu and items (values: start (default), end, bottom, top, center_horizontal, center_vertical, center) |
app:fabAnimateMenu |
Flag to animate menu toggle |
floatingActionButton.setFabType(); /* Set button type | FloatingActionButton.FAB_TYPE_CIRCLE,
FloatingActionButton.FAB_TYPE_SQUARE,
FloatingActionButton.FAB_TYPE_ROUNDED_SQUARE */
floatingActionButton.setFabSize(); /* Set button size | CustomFloatingActionButton.FAB_SIZE_NORMAL,
CustomFloatingActionButton.FAB_SIZE_MINI */
floatingActionButton.setFabText(); // Set text label
floatingActionButton.setFabTextAllCaps(); // Set label all capitals
floatingActionButton.setFabTextColor(); // Change color of label
floatingActionButton.setFabElevation(); // Change elevation
floatingActionButton.setFabColor(); // Change background color
floatingActionButton.setFabIcon(); // Change icon
floatingActionButton.setFabIconColor(); // Change icon color
floatingActionButton.setFabIconPosition(); /* Change icon position | CustomFloatingActionButton.FAB_ICON_START,
CustomFloatingActionButton.FAB_ICON_TOP,
CustomFloatingActionButton.FAB_ICON_END,
CustomFloatingActionButton.FAB_ICON_BOTTOM */
floatingActionLayout.setFabType(); /* Set button type | FloatingActionLayout.FAB_TYPE_CIRCLE,
FloatingActionLayout.FAB_TYPE_SQUARE,
FloatingActionLayout.FAB_TYPE_ROUNDED_SQUARE */
floatingActionLayout.setFabElevation(); // Change elevation
floatingActionLayout.setFabColor(); // Change background color
floatingLayout.setFabAnimationStyle(); /* Set the pop animation of items | FloatingLayout.ANIMATION_POP_UP,
FloatingLayout.ANIMATION_POP_DOWN,
FloatingLayout.ANIMATION_POP_RIGHT,
FloatingLayout.ANIMATION_POP_LEFT */
floatingLayout.setFabMenuGravity(); /* Set gravity of menu items | FloatingLayout.MENU_GRAVITY_START,
FloatingLayout.MENU_GRAVITY_END,
FloatingLayout.MENU_GRAVITY_BOTTOM,
FloatingLayout.MENU_GRAVITY_TOP,
FloatingLayout.MENU_GRAVITY_CENTER_HORIZONTAL,
FloatingLayout.MENU_GRAVITY_CENTER_VERTICAL,
FloatingLayout.MENU_GRAVITY_CENTER */
floatingLayout.setOnMenuExpandedListener(new FloatingLayout.OnMenuExpandedListener() {
@Override
public void onMenuExpanded() {
// Do stuff when expanded...
}
@Override
public void onMenuCollapsed() {
// Do stuff when collapsed...
}
});
Some bug fixing
Second version of library. Totaly rewritten. Added Floating action layout and Floating layout
First version of library with some bugfixes
- 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
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 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.