All Projects → niniloveyou → Statebutton

niniloveyou / Statebutton

Licence: mit
一个可以用代码设置selector背景(按下去背景颜色更改,样式变化等等)的button, 再也不用写selector了

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Statebutton

Tristatetogglebutton
Customizable tri-state toggle button (with three states, three state toggle) for Android
Stars: ✭ 198 (-84.48%)
Mutual labels:  button, selector
React Native Selectmultiple Button
A button (or a grouped buttons) supporting multiple or radio selection by building with React Native. https://github.com/danceyoung/selectmultiplebuttons for Swift.
Stars: ✭ 72 (-94.36%)
Mutual labels:  button
Buttonanimator
自定义按钮,动画,跳转动画
Stars: ✭ 47 (-96.32%)
Mutual labels:  button
Fitbutton
The button which can use with icon, text, divider, custom ripple effect, border, corner radius e.t.c.
Stars: ✭ 63 (-95.06%)
Mutual labels:  button
Progressbutton
Custom ProgressButton
Stars: ✭ 52 (-95.92%)
Mutual labels:  button
Recordbutton
Android record button view
Stars: ✭ 65 (-94.91%)
Mutual labels:  button
React Propers
Select react doms , and update props.
Stars: ✭ 40 (-96.87%)
Mutual labels:  selector
React Planet
A react lib for building circular menus in a very easy and handy way.
Stars: ✭ 83 (-93.5%)
Mutual labels:  button
Vue Progress Button
Animated button for VueJS
Stars: ✭ 71 (-94.44%)
Mutual labels:  button
Particleeffectsbuttons
A little library that can be used for bursting particles effects on buttons and other elements
Stars: ✭ 1,122 (-12.07%)
Mutual labels:  button
Animatedpencil
Animated Pencil Action view for Android
Stars: ✭ 61 (-95.22%)
Mutual labels:  button
Ripple Without Js
Create Material Design ripple effect in your HTML without using a single line of JS.
Stars: ✭ 53 (-95.85%)
Mutual labels:  button
P5.clickable
Event driven, easy-to-use button library for P5.js 👆
Stars: ✭ 66 (-94.83%)
Mutual labels:  button
Tvosmorebutton
📺 tvOS '... More' Button
Stars: ✭ 51 (-96%)
Mutual labels:  button
Postcss Prefix Selector
Prefix all CSS rules with a selector
Stars: ✭ 75 (-94.12%)
Mutual labels:  selector
Sizeslidebutton
A fun Swift UIControl for picking a size
Stars: ✭ 46 (-96.39%)
Mutual labels:  button
React Native Modal Dropdown
A react-native dropdown/picker/selector component for both Android & iOS.
Stars: ✭ 1,103 (-13.56%)
Mutual labels:  selector
Transitionbutton
UIButton sublass for loading and transition animation.
Stars: ✭ 1,124 (-11.91%)
Mutual labels:  button
Angular2 Promise Buttons
Chilled loading buttons for angular2
Stars: ✭ 84 (-93.42%)
Mutual labels:  button
Wymaterialbutton
Interactive and fully animated Material Design button for iOS developers.
Stars: ✭ 80 (-93.73%)
Mutual labels:  button

StateButton

###中文版这里: https://github.com/niniloveyou/StateButton/blob/master/README_CHINESE.md

Do you hate to write a background for each button?

Do you hate to write a bunch of selector?

That's why I'm writing this view.

Here to download demo

https://github.com/niniloveyou/StateButton/blob/master/demo.apk

Screenshot

Download

   allprojects {
       repositories {
           ......
           maven { url 'https://jitpack.io' }
       }
   }
   implementation 'com.github.niniloveyou:StateButton:v1.0.0'
   

Customizable attributes

Attribute default value xml java
normalTextColor original text color normalTextColor setNormalTextColor(int color)
pressedTextColor original text color pressedTextColor setPressedTextColor(int color)
unableTextColor original text color unableTextColor setUnableTextColor(int color)
strokeDashWidth 0 strokeDashWidth setStrokeDash(int dashWidth, int dashGap)
strokeDashGap 0 strokeDashGap setStrokeDash(int dashWidth, int dashGap)
normalStrokeWidth 0 normalStrokeWidth setNormalStrokeWidth(int widht)
pressedStrokeWidth 0 pressedStrokeWidth setPressedStrokeWidth(int widht)
unableStrokeWidth 0 unableStrokeWidth setUnableStrokeWidth(int widht)
normalStrokeColor 0 normalStrokeColor setNormalStrokeColor(int color)
pressedStrokeColor 0 pressedStrokeColor setPressedStrokeColor(int color)
unableStrokeColor 0 unableStrokeColor setUnableStrokeColor(int color)
normalBackgroundColor 0 normalBackgroundColor setNormalBackgroundColor(int color)
pressedBackgroundColor 0 pressedBackgroundColor setPressedBackgroundColor(int color)
unableBackgroundColor 0 unableBackgroundColor setUnableBackgroundColor(int color)
radius 0 radius setRadius(int radius) / setRadius(float[] radii)
round false round setRound(boolean round)
animationDuration 0ms animationDuration setAnimationDuration(int duration)

Usage

If the default values of custom attribues did not meet your requirement, you can easily re-config that attributes. This is sample code that you can refer. you can also browse demo app for more details.

via xml (sample)

  • Define xmlns:app="http://schemas.android.com/apk/res-auto" on root of your xml file
<deadline.statebutton.StateButton
            android:id="@+id/stateButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="StateButton"
            
            app:radius="5dp"
            app:round="true"
            app:animationDuration="200"
            
            app:strokeDashGap="2dp"
            app:strokeDashWidth="5dp"
            app:normalStrokeWidth="2dp"
            app:pressedStrokeWidth="2dp"
            app:unableStrokeWidth="2dp"
            
            app:normalStrokeColor="@android:color/white"
            app:pressedStrokeColor="@android:color/white"
            app:unableStrokeColor="@android:color/white"
            
            app:normalTextColor="@android:color/white"
            app:pressedTextColor="@android:color/white"
            app:unableTextColor="@android:color/white"
            
            app:normalBackgroundColor="@color/colorPrimaryDark"
            app:pressedBackgroundColor="@color/colorPrimaryDark"
            app:unableBackgroundColor="@color/colorPrimaryDark"/>

Developed By

deadline

Blog : http://www.jianshu.com/users/25e80ace21b8/latest_articles

MIT License

  Copyright (c) 2016 deadline

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].