Giter Club home page Giter Club logo

fancybuttons's Introduction

⚠️ This library was made years ago when it wasn't that easy to customize Android buttons like today. I highly recommend you to use Material Design button as it offers the same features and most importantly it's backed by the Android Team.


Fancybuttons

Icons, Borders, Radius ... for Android buttons jCenter jitPack Android Arsenal

Android About Page Cover

Overview

FancyButtons Android

Demo Application : Download APK

Features

  • Border (stroke, radius, color)
  • Background (normal, focus)
  • Icon (Drawable, font Icon)
  • Icon (Position, size)
  • Icon Size
  • Icon Padding

Changelog

  • 1.9.1

    • Fix getting the font
  • 1.9.0

    • Add support for font resources (For text font only)
    • Increase min API level to 14
    • Now you can use these to set text font (res/font/roboto_slab_bold.ttf): android:fontFamily="@font/roboto_slab_bold" fancy:fb_textFontRes="@font/roboto_slab_bold"
    • Add dependency on support library used only when using font resources.
  • 1.8.4

    • Fix Text Gravity
    • Add Ability to define custom radius value for each corner
  • 1.8.3

    • Fixed long searching of font
    • Added ability to use android:text, android:textSize, android:testAllCaps attributes
    • Fixed preview issues with android:* attrs
    • Added opportunity to use android:* attrs in styles
    • Added ability to use custom LayoutParams instead of the default one
    • Force refreshing the view when setEnabled(boolean) is called
    • Minor optimization & refactoring
  • 1.8.2

    • Added ability to disable button
    • Added ability to use system font
  • 1.8.1

    • Fix Bug related to loading custom fonts
  • 1.8

    • Add setIconResource(Drawable)
    • Cache fonts
  • 1.7

    • Fix ripple effect when background is transparent
    • Add capitalization of text
  • 1.6

    • Add ripple effect
    • Upgrade Font Awesome to 4.5.0

Installation

implementation 'com.github.medyo:fancybuttons:1.9.1'

To use font resources add support library to your dependencies:

implementation "com.android.support:appcompat-v7:$support_lib_version"

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 Attributes

XML Attribute Java Attribute Description
fancy:fb_text setText(String) Text of the button
fancy:fb_textColor setTextColor(int) Text Color of the button
fancy:fb_textSize setTextSize(int) Size of the text
fancy:fb_textFont setCustomTextFont(String) FontFamily of the text
fancy:fb_textFontRes setCustomTextFont(int) FontFamily of the text using font resource. REQUIRES support library
fancy:fb_textGravity setTextGravity(Int) Gravity of the text
fancy:fb_iconResource setIconResource(Drawable) Drawable icon of the button
fancy:fb_iconPosition setIconPosition(int) Position of the icon : Left, Right, Top, Bottom
fancy:fb_fontIconResource setIconResource(String) font icon of the button
fancy:fb_fontIconSize setFontIconSize(int) Size of the icon
fancy:fb_iconFont setCustomIconFont(String) FontFamily of the icon
fancy:fb_borderWidth setBorderWidth(int) Width of the border
fancy:fb_borderColor setBorderColor(int) Color of the border
fancy:fb_defaultColor setBackgroundColor(int) Background color of the button
fancy:fb_focusColor setFocusBackgroundColor(int) Focus Color of button background
fancy:fb_disabledColor setDisableBackgroundColor(int) Disabled Color of button background
fancy:fb_disabledTextColor setDisableTextColor(int) Disabled Color of button text
fancy:fb_disabledBorderColor setDisableBorderColor(int) Disabled Color of button border
fancy:fb_radius setRadius(int) Radius of the button
fancy:fb_radius(TopLeft, TopRight,BottomLeft,BottomRight) setRadius(int[] radius) Custom Radius for each button corner
fancy:fb_iconPaddingLeft setIconPadding(int,int,int,int) Icon Padding
fancy:fb_iconPaddingRight setIconPadding(int,int,int,int) Icon Padding
fancy:fb_iconPaddingTop setIconPadding(int,int,int,int) Icon Padding
fancy:fb_iconPaddingBottom setIconPadding(int,int,int,int) Icon Padding
fancy:fb_ghost setGhost(boolean) Ghost (Hollow)
fancy:fb_useSystemFont setUsingSystemFont(boolean) If enabled, the button title will ignore its custom font and use the default system font

Also you can use Attributes with default prefix (android:) which makes migrating of your project more fast. Default Attributes have more priority than Attributes with prefix fancy.

Supported default Attributes

XML Attribute
android:enabled
android:text
android:textSize
android:textAllCaps
android:fontFamily

Supported Getters

| Function | Description | | ------------- |:-------------:| -----:| | getText() | Returns Text Value of the button| | getTextViewObject() | Returns TextView Object| | getIconFontObject() | Returns icon defined by fb_fontIconResource| | getIconImageObject() | Returns icon defined by fb_iconResource |

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:fb_borderColor="#FFFFFF"
	fancy:fb_borderWidth="1dp"
	fancy:fb_defaultColor="#7ab800"
	fancy:fb_focusColor="#9bd823"
	fancy:fb_fontIconResource="&#xf04b;"
	fancy:fb_iconPosition="left"
	fancy:fb_radius="30dp"
	fancy:fb_text="SHUFFLE PLAY"
	fancy:fb_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 :


FancyButtons AndroidFancyButtons AndroidFancyButtons Android

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 OR for text fonts add it to res/font/ and use android:fontFamily or fancy:fb_textFontRes to use it.

Contributions

Fancybuttons needs you to build the missing features :

  • Supporting Circular buttons
  • Add elevation (Material Design)

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

abdelrahman-elkady avatar amatkivskiy avatar donlianggit avatar esafirm avatar fahimk avatar haegon avatar mariotaku avatar medyo avatar pishguy avatar s424242 avatar vkrissz avatar ymback avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fancybuttons's Issues

Cannot Align Text

Hello,
I wan't to align button text left but text aligment has not implemented. Is there any workaround?

Ripple effect not working when defaultColor is set to transparent

Ripple effect feature that comes with the version 1.6 is not working when we set the fb_defaultColor to @android:color/transparent. In other words, the color to which we set fb_focusColor, has no effect if default color is transparent. Previous versions do not have such problem. In v1.5, even if default color is set to transparent, focus color has still an effect.

Could you please solve this problem that occurs in v1.6?

Icon drawabe is not centered by default?

Hi

I found the icon drawable is not centered, even if I used gravity attribute, see screenshot (the arrow down icon on the top right):
image

I have to use icon padding to do so. Am I using something wrong or this can be improved.

Can't set focus to a button

Hi,
I want to set the borderColor when the button is focused but it does nothing. Nothing change. It's like your library doesn't support focus listener. Could you help me? Thanks

Resource Icon Size

Hi
Is there is a way to change icon size if I use resource icon, not font icon?

Icon not displaying in button, showing file path in directory instead

Just started using, so highly probable it is my own mistake. It is also not displaying the icon correctly in the preview. It shows me a circle near the text. It is supposed to look like https://cdn0.iconfinder.com/data/icons/thin-voting-awards/24/thin-0665_vote_ticket_paper_voting-128.png

`<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                xmlns:fancy="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingBottom="@dimen/activity_vertical_margin"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:paddingTop="@dimen/activity_vertical_margin"
                tools:context=".activites.VoteActivity">
<android.support.v7.widget.RecyclerView
    android:id="@+id/classification_select"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_marginTop="39dp"
    android:layout_below="@+id/textView"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="Question"
    android:id="@+id/textView"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="27dp"/>

<mehdi.sakout.fancybuttons.FancyButton
    android:id="@+id/btn_vote"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/classification_select"
    android:paddingRight="10dp"
    fancy:fb_borderWidth="1dp"
    fancy:fb_fontIconResource="@drawable/ic_votee"
    fancy:fb_fontIconSize="30sp"
    android:layout_centerHorizontal="true"
    fancy:fb_radius="10dp"
    fancy:fb_text="SUBMIT"
    fancy:fb_iconPosition="left"
    fancy:fb_defaultColor="#4a148c"
    />
![erro](https://cloud.githubusercontent.com/assets/17652993/15459381/a6da5310-2072-11e6-8e20-708f71d56835.png) `

Caused by: java.lang.ClassCastException: mehdi.sakout.fancybuttons.FancyButton cannot be cast to android.widget.Button

This is my log. I added two buttons and tried to tie it to and activity.

Process: com.example.max_poly.driverecord, PID: 1553
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.max_poly.driverecord/com.example.max_poly.driverecord.MenuActivity}: java.lang.ClassCastException: mehdi.sakout.fancybuttons.FancyButton cannot be cast to android.widget.Button
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: mehdi.sakout.fancybuttons.FancyButton cannot be cast to android.widget.Button
at com.example.max_poly.driverecord.MenuActivity.onCreate(MenuActivity.java:20)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)

layout code:

<mehdi.sakout.fancybuttons.FancyButton
    android:id="@+id/btn_recordPath"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp"
    fancy:fb_borderColor="#FFFFFF"
    fancy:fb_borderWidth="1dp"
    fancy:fb_defaultColor="#7ab800"
    fancy:fb_focusColor="#9bd823"
    fancy:fb_fontIconResource="&#xf041;"
    fancy:fb_iconPosition="left"
    fancy:fb_radius="100dp"
    fancy:fb_text="Record your Path"
    fancy:fb_textSize = "15dp"
    fancy:fb_fontIconSize = "15dp"
    fancy:fb_textColor="#FFFFFF"
    android:layout_gravity="center_horizontal" />


<mehdi.sakout.fancybuttons.FancyButton
    android:id="@+id/btn_history"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp"
    fancy:fb_borderColor="#FFFFFF"
    fancy:fb_borderWidth="1dp"
    fancy:fb_defaultColor="#7ab800"
    fancy:fb_focusColor="#9bd823"
    fancy:fb_fontIconResource="&#xf1da;"
    fancy:fb_iconPosition="left"
    fancy:fb_radius="100dp"
    fancy:fb_text="History"
    fancy:fb_textSize = "15dp"
    fancy:fb_fontIconSize = "15dp"
    fancy:fb_textColor="#FFFFFF"
    android:layout_gravity="center_horizontal" />

activity code:
public class MenuActivity extends Activity {
private Button btRecordPath_;
private Button btHistory_;

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.menu_activity);

/**/ btRecordPath_ = (Button)findViewById(R.id.btn_recordPath);
// btHistory_ = (Button) findViewById(R.id.btn_history);

    btRecordPath_.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent myIntent = new Intent(MenuActivity.this, MapActivitySecond.class);
            MenuActivity.this.startActivity(myIntent);
        }
    });
}

}

the logcat points the line 20 which is where I put the /**/

                       *
                     *   *

Edit:

Well I solved the problem.
1- In my activity I should have declared the buttons as FancyButton instead of Button
2- In my androidManifest I should have registered my activity by adding under the main activity in the application tag.
Very easy going library, thanks again

text worng show

<mehdi.sakout.fancybuttons.FancyButton
    android:id="@+id/item_buy"
    android:layout_width="200dip"
    android:layout_height="38dip"
    fancy:fb_defaultColor="#ff9900"
    fancy:fb_focusColor="#dd8603"
    fancy:fb_radius="4dp"
    fancy:fb_text="SHOW_WRONG"
    />

just show the half top of the content on SAMSUNG GT-I9200

[solved] Spannable Text

Hi, How can we use Spannable Text for the button title?

The setText() method requires String, so cant use spanned text
any other work around?

Html.fromHtml("...");

I am trying this in API level 21 and 22

Public method : getText is missing

A missing getText method makes this unusable in onClick events. One has to resort to knowing the internals of FancyButton layout to extract text.

The following complex query is used currently to find text of the button which was clicked

            public void onClick(View view) {
                TextView tv = (TextView)((LinearLayout) view).getChildAt(0);
                Log.d("onClick", tv.getText().toString());
            }

Needed
public String getText();

Graphic scaling

Does the library support scaling of graphics?

I have a ImageButtton I'm trying to replace. I have it working with ImageButton with the following:

<ImageButton

    android:id="@+id/app_list_refresh_button"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_margin="5dp"
    android:adjustViewBounds="false"
    android:padding="1dp"
    android:scaleType="fitCenter"
    android:src="@drawable/button_refresh"
    android:background="@color/button_material_dark"/>

The image is 256x256 and I'm trying to have the button scale it down to fit into the FancyButton. But, I can't get it to scale down.

   <mehdi.sakout.fancybuttons.FancyButton
        android:id="@+id/app_list_refresh_button"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:padding="5dp"
        fancy:fb_iconResource="@drawable/button_refresh"
        fancy:fb_fontIconSize="25dp"
        fancy:fb_iconPaddingLeft="0dp"
        fancy:fb_iconPaddingRight="0dp"
        fancy:fb_defaultColor="#696969"
        fancy:fb_focusColor="#a9a9a9"
        fancy:fb_radius="5dp"/>

Button not showing up

I have a simple button defined like this:

        <mehdi.sakout.fancybuttons.FancyButton
            android:id="@+id/rate_button2"
            android:layout_width="100dp"
            android:layout_height="100dp"
            fancy:fb_borderWidth="1dp"
            fancy:fb_defaultColor="#ffffff"
            fancy:fb_focusColor="#9bd823"
            fancy:fb_iconResource="@drawable/rate_button"
            fancy:fb_iconPosition="left"
            fancy:fb_radius="50dp"
            fancy:fb_text="Rate"
            fancy:fb_textColor="#FFFFFF" />

But it is showing up like this?

screen shot 2016-01-31 at 7 58 28 am

Padding between fontIcon and text

Can you add a parameter to adjust manually the padding between fonticon and text and icon and text?

Now if the text is large enough, the icon grows in height instead of shrinking the padding between icon and text.

Thanks.

setIconResource(Drawable) problem

When you use the method setIconResource(Drawable), the button loses the text gravity. You need to use setTextGravity() after or the button will be aligned to the left by default.

ClassCastException

Hi can you please tel me why I'm getting class cast exception, it seems to work fine in another activity.

12-02 23:54:31.010 27853-27853/outletwise.com.twentydresses E/AndroidRuntime: FATAL EXCEPTION: main
Process: outletwise.com.twentydresses, PID: 27853
java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams
at android.widget.RelativeLayout$DependencyGraph.findRoots(RelativeLayout.java:1722)
at android.widget.RelativeLayout$DependencyGraph.getSortedViews(RelativeLayout.java:1667)
at android.widget.RelativeLayout.sortChildren(RelativeLayout.java:373)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:381)
at android.view.View.measure(View.java:16543)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1241)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.widget.ScrollView.onMeasure(ScrollView.java:326)
at android.view.View.measure(View.java:16543)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5147)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.support.v7.widget.CardView.onMeasure(CardView.java:196)
at android.view.View.measure(View.java:16543)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5147)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16543)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
at android.view.View.measure(View.java:16543)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5147)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
at android.view.View.measure(View.java:16543)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5147)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1430)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:716)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:609)
at android.view.View.measure(View.java:16543)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5147)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16543)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5147)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1430)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:716)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:609)
at android.view.View.measure(View.java:16543)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5147)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2327)
at android.view.View.measure(View.java:16543)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1979)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1140)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1331)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1027)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5884)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:780)
at android.view.Choreographer.doCallbacks(Choreographer.java:593)
at android.view.Choreographer.doFrame(Choreographer.java:562)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:766)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5253)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:939)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
at dalvik.system.NativeStart.main(Native Method)

setCustomTextFont

How do I can use setCustomTextFont?
Do not know how to use a custom font as string.

How to Use

Hello, I'm really a beginner. How to use your library, please help me. I want to use these buttons in my project.

Circular button?

hey guys

I tried make a circular button. In my Moto G is perfect, but in Galaxy S5 of my friend the button not is circular :/

How I can make a real circular button?

<mehdi.sakout.fancybuttons.FancyButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:paddingTop="15dp"
            android:paddingBottom="15dp"
            android:paddingLeft="17dp"
            android:paddingRight="17dp"
            fancy:radius="30dp"
            fancy:fontIconSize="11dp"
            fancy:fontIconResource="&#xf067;"
            fancy:defaultColor="@color/buttons"
            fancy:focusColor="@color/buttonsFocus"
            android:id="@+id/buttonMore" />

How to use in the listview or gridview

i tried to use this fancy~ fancyButton in my GridView

but as i expected, it didn't work because it gets focus more than GridView

so i assigned some attrs to fancyButton like

android:focusable="false"
android:focusableInTouchMode="false"

it worked great when it was ImageButton,

But.. it didn't work.. so i can't not use onItemClickListener of GrideView right now T^T

Text is centered

" textView.setGravity(Gravity.CENTER); "
Make the text centered which i don't prefer and in 2 lines, i wish if there is a way to get around it ?
untitled

setText via code crashes the app

sett text via XML works OK but when trying to set text like this:
mButton.setText("banana");
i get the following:

02-24 17:08:36.578 12189-12189/com.vidback.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams
at android.widget.RelativeLayout$DependencyGraph.findRoots(RelativeLayout.java:1723)
at android.widget.RelativeLayout$DependencyGraph.getSortedViews(RelativeLayout.java:1670)
at android.widget.RelativeLayout.sortChildren(RelativeLayout.java:382)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:403)
at android.view.View.measure(View.java:16831)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16831)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16831)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2586)
at android.view.View.measure(View.java:16831)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2189)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1352)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1535)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6364)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:561)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)

Image Icon not set dynamically

Hi medyo,

How can i set dynamically downloaded images as setIconResource function?
i am confused about it that it is only taking int and string rather than drawable or bitmap.

Hollow buttons focus color

If I have a hollow button ( With transparent background and a border ) ... the focus color colors the whole body , it could be tweaked to change the border only

How do I create circle buttons?

Hi,
You've got a really awesome library. Thanks for making Android buttons saner 💃
But, I can't figure out how to make circular fancybuttons.
I'm setting fancy:radius="30dp" but it feels hacky, and doesn't always yield perfectly round buttons.

I see some circle buttons in your documentation images. Is there something I'm missing?

Set Drawable as Icon

How can I set manually the drawable icon?

public void setIconResource(int drawable)
public void setIconResource(String icon)
public void setIconResource(Drawable drawable) <--- ??? Missing :)

fancy:fb_text

Hellow, nice lin

Is there a way to set fancy:fb_text bold?

Setting text color programmatically doesn't change icon color

using setTextColor changes only the text color without the icon's color , however setting it in the xml changes both

steps to reproduce :

  1. create a button in xml with a font icon
  2. find and grab the button in an activity
  3. call setTextColor(int color) on the button

The button will change only the text color and the icon color will remain as given in the xml

FancyButton text does not appear in Dialog

If I try to display a FancyButton in a Dialog, I get the following result :

capture d ecran 2016-03-30 a 18 04 03

I used the exact same code as the sample (Spotify button).

Do you have a clue about that ?

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.