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
compile 'com.robertlevonyan.view:CustomFloatingActionButton:1.0.3'
<dependency>
<groupId>com.robertlevonyan.view</groupId>
<artifactId>CustomFloatingActionButton</artifactId>
<version>1.0.3</version>
<type>pom</type>
</dependency>
<com.robertlevonyan.views.customfloatingactionbutton.CustomFloatingActionButton
android:id="@+id/custom_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end" />
app:fabIcon="@drawable/customIcon"
app:fabIconColor="@color/customColor"
app:fabSizes="mini"
app:fabType="square"
app:fabType="roundedSquare"
app:fabText="@string/stringRes"
app:fabIconPosition="end"
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 |
Drop shadow size |
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:fabIconPosition |
Icon position for icon (values: start (default), top, end, bottom) |
CustomFloatingActionButton customFAB = (CustomFloatingActionButton) findViewById(R.id.custom_fab);
customFab.setOnFabClickListener(new OnFabClickListener() {
@Override
public void onFabClick(View v) {
//Your action here...
}
});
customFAB.setFabType(); /* Set FAB type | CustomFloatingActionButton.FAB_TYPE_CIRCLE,
CustomFloatingActionButton.FAB_TYPE_SQUARE,
CustomFloatingActionButton.FAB_TYPE_ROUNDED_SQUARE */
customFAB.setFabSize(); /* Set FAB size | CustomFloatingActionButton.FAB_SIZE_NORMAL,
CustomFloatingActionButton.FAB_SIZE_MINI */
customFAB.setFabText(); // Set text label
customFAB.setFabTextAllCaps(); // Set label all capitals
customFAB.setFabTextColor(); // Change color of label
customFAB.setFabElevation(); // Change drop shadow size
customFAB.setFabColor(); // Change FAB color
customFAB.setFabIcon(); // Change FAB icon
customFAB.setFabIconColor(); // Change FAB icon color
customFAB.setFabIconPosition(); /* Change FAB icon position | CustomFloatingActionButton.FAB_ICON_START,
CustomFloatingActionButton.FAB_ICON_TOP,
CustomFloatingActionButton.FAB_ICON_END,
CustomFloatingActionButton.FAB_ICON_BOTTOM */
First version of library with some bugfixes
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.