Git Product home page Git Product logo

fancybuttons's Introduction

FancyButtons

FancyButtons AndroidFancyButtons Android

I always found some difficulties to make great Android buttons, since i need to override everything or make lot of drawables files to handle focus, pressed and normal state. For that reason, i made Fancy Buttons, to make this task much easier.

Overview

FancyButtons, helps you to easily create fancy buttons without the need of drawable files.

FancyButtons Android

Features

  • Border (stroke, radius, color)
  • Background (normal, focus)
  • Icon (Drawable, font icon)
    • FontAwsome
    • Custom font
  • Icon (Position, size)
    • right
    • left
    • top
    • bottom
  • Icon Size
  • Icon Padding

Including in your project : Maven Central

compile 'com.github.medyo:fancybuttons:1.2@aar'

Usage

1 - Include FancyButtons namespace to the root element :

xmlns:fancy="http://schemas.android.com/apk/res-auto" 

2 - Add the FancyButton View with custom params :

<mehdi.sakout.fancybuttons.FancyButton
android:id="@+id/btn_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Supported Attributs

XML Attribut Java Attribut Description
fancy:text setText(String) Text of the button
fancy:textColor setTextColor(int) Text Color of the button
fancy:textSize setTextSize(int) Size of the text
fancy:textFont setCustomTextFont(String) FontFamily of the text
fancy:textGravity setTextGravity(Int) Gravity of the text
fancy:iconResource setIconResource(Drawable) Drawable icon of the button
fancy:iconPosition setsetIconPosition(int) Position of the icon : Left, Right, Top, Bottom
fancy:fontIconResource setIconResource(String) font icon of the button
fancy:fontIconSize setFontIconSize(int) Size of the icon
fancy:iconFont setCustomIconFont(String) FontFamily of the icon
fancy:borderWidth setBorderWidth(int) Width of the border
fancy:borderColor setBorderColor(int) Color of the border
fancy:defaultColor setBackgroundColor(int) Background color of the button
fancy:focusColor setFocusBackgroundColor(int) Focus Color of border background
fancy:radius setRadius(int) Radius of the button
fancy:iconPaddingLeft setIconPadding(int,int,int,int) Icon Padding
fancy:iconPaddingRight setIconPadding(int,int,int,int) Icon Padding
fancy:iconPaddingTop setIconPadding(int,int,int,int) Icon Padding
fancy:iconPaddingBottom setIconPadding(int,int,int,int) Icon Padding

Sample

1 - Spotify Button

FancyButton Spotify

<mehdi.sakout.fancybuttons.FancyButton
android:id="@+id/btn_spotify"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
fancy:borderColor="#FFFFFF"
fancy:borderWidth="1dp"
fancy:defaultColor="#7ab800"
fancy:focusColor="#9bd823"
fancy:fontIconResource="&#xf04b;"
fancy:iconPosition="left"
fancy:radius="30dp"
fancy:text="SHUFFLE PLAY"
fancy:textColor="#FFFFFF" />

2 - Facebook Button

FancyButton Facebook

FancyButton facebookLoginBtn = new FancyButton(this);
facebookLoginBtn.setText("Login with Facebook");
facebookLoginBtn.setBackgroundColor(Color.parseColor("#3b5998"));
facebookLoginBtn.setFocusBackgroundColor(Color.parseColor("#5474b8"));
facebookLoginBtn.setTextSize(17);
facebookLoginBtn.setRadius(5);
facebookLoginBtn.setIconResource("\uf082");
facebookLoginBtn.setIconPosition(FancyButton.POSITION_LEFT);
facebookLoginBtn.setFontIconSize(30);

See the example project for more samples

Bonus

Fancybuttons is delivered with :


FAQ

How to add new fonts ?
Just Paste your font inside assets/fonts/ folder for Text fonts or inside assets/iconfonts/ for icon fonts eg : entypo

Licence

MIT http://opensource.org/licenses/MIT

Developed By

El Mehdi Sakout

Follow @medyo80 on Twitter for the latest news.

For contact, shoot me an email at [email protected]

fancybuttons's People

Contributors

medyo avatar abdelrahman-elkady avatar donlianggit avatar fahimk avatar s424242 avatar

Watchers

william avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.