# niniloveyou/StateButton

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

Repository: https://github.com/niniloveyou/StateButton
Canonical: https://ross.abutalabs.com/products/statebutton
Language: Java
License: MIT
License Family: permissive
Topics: button, statebutton, selector, android
Last push: 2019-01-23T02:46:50+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 3586, "days_push": 2779, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1285, forks 220 (observed 2026-08-28T04:04:14.678515+00:00)

## What it is
An Android custom Button view that lets you set pressed, disabled, and normal state backgrounds, text colors, strokes, and corner radii directly in code or XML, eliminating the need to write selector drawables. Distributed via JitPack and written in Java.

## Use cases
- set button pressed state background color without writing selector xml
- create rounded or stroke buttons programmatically on Android
- customize button states (normal, pressed, disabled) in code
- avoid writing drawable selector files for each button
- add animated color transitions to Android buttons

## When to choose
- you're building an Android UI with many styled buttons and want to skip selector XML files
- you need per-state colors, strokes, and radii configurable from Java or XML

## When to avoid
- you're not developing for Android
- you need Material Design component behaviors like ripples beyond simple state styling
- you need a very actively maintained dependency - last release was 2019

## Facets
- artifact type: library
- maturity: maintenance
- function: ui-components, mobile-framework
- domain: mobile-development, android-tools, frontend
- platform: jvm
- tags: android-button, selector, drawable-state, ui-widget, jitpack, android, mobile

## Member repositories
- niniloveyou/StateButton (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:14.678515+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:56:40.895080+00:00, confidence not recorded.
  - readme: https://github.com/niniloveyou/StateButton (fetched 2026-08-28T04:04:14.678515+00:00, sha e3a3cd828037)
- Data as of 2026-08-30T08:39:29.467469+00:00.
