Git Product home page Git Product logo

fitbutton's Introduction

Download API Android Arsenal

FitButton

The button which includes features:

  • Icon,
  • Text,
  • Divider,
  • Corner radius,
  • Border of the button,
  • Custom ripple effect,
  • Custom elements sizes,
  • Custom colors of elements,
  • Different positions of elements on the button

Installation

Gradle

implementation "com.github.nikartm:fit-button:$fb_version"

Screenshots

FitButton Screenshots

FitButton Screenshots FitButton Screenshots FitButton Screenshots

How to use?

Adjust the XML view:

More examples

<com.github.nikartm.button.FitButton
    android:id="@+id/fbtn"
    android:layout_width="match_parent"
    android:layout_height="58dp"
    android:layout_margin="32dp"
    android:enabled="true"
    android:gravity="center_vertical"
    app:fb_cornerRadius="2dp"
    app:fb_shape="rectangle"
    app:fb_divColor="#fff"
    app:fb_divWidth="1dp"
    app:fb_divHeight="40dp"
    app:fb_rippleColor="#FBE9E7"
    app:fb_iconWidth="28dp"
    app:fb_iconHeight="28dp"
    app:fb_iconPosition="left"
    app:fb_iconMarginStart="20dp"
    app:fb_iconMarginEnd="16dp"
    app:fb_icon="@drawable/ic_thumb_up"
    app:fb_iconColor="#FFF"
    app:fb_textPaddingStart="16dp"
    app:fb_textColor="#FFF"
    app:fb_text="Like Me"
    app:fb_backgroundColor="#FF7043"/>

Or programmatically:

private fun setupButton() {
    fitButton = findViewById(R.id.fbtn)
    fitButton!!
            .setTextFont(R.font.share_tech_regular)
            .setWidth(250)
            .setHeight(70)
            .setTextSize(20f)
            .setIconMarginStart(16f)
            .setIconMarginEnd(12f)
            .setTextColor(Color.parseColor("#F5F5F5"))
            .setIconColor(Color.parseColor("#FFFFFF"))
            .setDividerColor(Color.parseColor("#BCAAA4"))
            .setBorderColor(Color.parseColor("#FFF59D"))
            .setButtonColor(Color.parseColor("#FF7043"))
            .setBorderWidth(2f)
            .setRippleEnable(true)
            .setRippleColor(resources.getColor(R.color.colorAccent))
            .setOnClickListener {
                Toast.makeText(this,
                        "Click on ${fitButton?.getText()}",
                        Toast.LENGTH_SHORT).show()
            }
}

Kotlin support

If you got an error

Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;

You may need to add Kotlin support to your project.

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

and add to the root build.gradle

buildscript {
    ext.kotlin_version = 'X.Y.Z'
    
    ...
}

License

Copyright 2019 Ivan Vodyasov

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.

fitbutton's People

Contributors

nikartx avatar

Watchers

James Cloos 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.