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
|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:'
com.robertlevonyan.view CustomFloatingActionButton LATEST_VERSION pom
||
|
|----------------------|-----------------------------------------------------------------------------------------|
|
|
|
|
|
|
<!--Add any layout here-->
</com.robertlevonyan.examples.customfloatingactionbutton.view.floatingactionlayout>
|Circle layout |Rounded square layout |Square layout |
|---------------------------------------|----------------------------------------|--------------------------------------|
||
|
|
<!-- 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> <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 ...></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: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.
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 */
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
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 */
//Java floatingLayout.setOnMenuExpandedListener(new FloatingLayout.OnMenuExpandedListener() { @Override public void onMenuExpanded() { // Do stuff when expanded... }@Override public void onMenuCollapsed() { // Do stuff when collapsed... } });
//Kotlin floatingLayout.doOnExpand { // Do stuff when expanded... }floatingLayout.doOnCollapse { // Do stuff when collapsed... }
Small updates
New version fully rewritten in Kotlin with several bugfixes
Some bug fixing
Second version of library. Totaly rewritten. Added Floating action layout and Floating layout
First version of library with some bugfixes
Custom Floating Action Button© Copyright 2017 Robert Levonyan Url: https://github.com/robertlevonyan/materialChipViewLicensed 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.