• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    Java
  • Created over 8 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android CompoundButtons (Switch, CheckBox, RadioButton) in Material Design, works on Android 4.0+(SDK 14). SmoothCompoundButton 是全套Material风格的Switch、CheckBox和RadioButton组件,纯Java代码(非贴图)像素级复刻了Material动画与阴影效果,支持Android 4.0+。基本实现了在不同Android版本上与Material风格一致的效果,体验优于官方AppCompat,可能是目前最好的Material风格CompoundButton组件之一。

SmoothCompoundButton

Android CompoundButtons (Switch, CheckBox, RadioButton) in Material Design, works on Android 4.0+(SDK 14).

SmoothCompoundButton 是全套Material风格的Switch、CheckBox和RadioButton组件,纯Java代码(非贴图)像素级复刻了Material动画与阴影效果,支持Android 4.0+。基本实现了在不同Android版本上与Material风格一致的效果,体验优于官方AppCompat,可能是目前最好的Material风格CompoundButton组件之一。

Screenshots

SmoothCompoundButton

Sample APK

SmoothCompoundButtonSample.apk

Features 特性

  • 完整地复刻了Material风格动画效果,顺滑!流畅!
  • 继承于Button,本身支持显示文字,无需配合TextView使用
  • 无文字时使按钮标记等比例充满View,这个在某些场景中很有用
  • Switch的thumb具有“逼真”的阴影,像素级代码实现而非贴图
  • toogle动画过程中的颜色变化为渐变效果
  • 按下效果和Material风格一致,可超出View布局边界,5.0+为原生ripple,4.x使用StateListDrawable实现类似效果
  • 支持“正确的”padding,系统的CheckBox和RadioButton对padding的处理很不合常理,见Sample
  • 支持ClickMarkOnly,是否仅按下“按钮标记”部分为toogle(即忽略点击文字部分)
  • 支持ReverseMarkPosition,是否反转“正常的按钮标记位置”
  • 支持RTL从右到左布局,不过懒得处理Switch的的按钮标记的左右了
  • 支持Disabled状态而无需任何手动配置
  • 无!任!何Resources!对,你没有听错,只需导入jar即可(原谅我这个强迫症患者)

Usage 用法

  • 只需导入jar
  • 使用SmoothSwitch、SmoothCheckBox、SmoothRadioButton、SmoothRadioGroup替换掉系统对应的类即可
  • Java api和系统CompoundButton完全一致,额外增加的一个方法:
public void setChecked(boolean checked, boolean withAnimation, boolean notifyOnCheckedChangeListener) 
  • 其他配置见下面的Attrs

Attrs 属性

除了支持android:checked,由于本Library无!任!何Resources!故从其他View中“借来”了几个属性:

attr format description notice
android:adjustViewBounds boolean ClickMarkOnly,是否仅可点击按钮标记部分 默认false,即整体可点击
android:cropToPadding boolean ReverseMarkPosition,是否反转“正常的按钮标记位置” 默认false,即正常位置
android:tint color MarkColor,按钮标记的颜色 如果是单个颜色则取为state_checked时的颜色,如果是selector会分别取两种对应状态的颜色
  • 如果没有指定android:gravity,则设置为Gravity.CENTER_VERTICAL
  • 其实android:checked也是借来的,这个是CompoundButton的属性,而SmoothCompoundButton的基类是继承于Button

Developed By

Mixiaoxiao - [email protected] or [email protected]

License

Copyright 2016 Mixiaoxiao

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.

More Repositories

1

Arduino-HomeKit-ESP8266

Native Apple HomeKit accessory implementation for the ESP8266 Arduino core.
C
1,515
star
2

Weather

A beautiful weather app: DynamicBackground (clear, rainy, foggy, etc), AqiView, DailyForecastView, HourlyForecastView and more. 一款精致的天气APP,动态天气背景(10*2种天气效果,每种区分白天和夜间)、一周天气曲线图、24H曲线图、空气质量/风速/日出日落图等。
Java
459
star
3

ESP8266-IR-HOMEKIT

原生HomeKit红外空调遥控
355
star
4

Arduino-HomeKit-ESP32

[Deprecated] Native Apple HomeKit accessory implementation for the ESP32 Arduino core.
C
226
star
5

OverScroll-Everywhere

Add the over-scroll feature to any scrollable view: RecyclerView, ScrollView, WebView, ListView, GridView, etc. Support both fling and drag over-scroll,and easy to customize the over-scroll style. 为任意可滑动的View定制越界效果(over-scroll),同时支持滑动惯性越界与拖动越界,方便地定制与扩展不同的越界风格。实现iOS弹性越界效果、微信“网页由xxx.com提供”的WebView效果、MIUI8的越界拉伸放大效果。
Java
112
star
6

FastScroll-Everywhere

Add the fast-scroll feature to any scrollable view: RecyclerView, ScrollView, WebView, ListView, GridView, etc. 为任意可滑动的View添加快速滑动,是的,任意。
Java
85
star
7

9GAG

9GAG-Android (unofficial), Android Design.
Java
71
star
8

Arduino-HomeKit-ESP

Arduino library version of espressif's official esp-homekit-sdk.
C
56
star
9

SplitLayout

Android SplitLayout, which splits the available space between two child views by dragging the center handle. 安卓分栏布局,包含2个子View,支持横向或纵向分栏,可通过拖动中间的handle来动态分割两个子View所占空间。
Java
36
star
10

NotificationTextColorCompat

Fetch the default system notification text color (ContentTitleColor and ContentTextColor) for your custom RemoteViews. 获取系统默认的通知文字颜色(标题和内容文字颜色),适配自定义通知的RemoteViews中的文字。已测试兼容各种国产ROM。
Java
21
star
11

StatusBarColorCompat

Change the StatusBarColor dynamically, works on Android 4.4+. 简单优雅地动态改变状态栏颜色,支持安卓4.4+。
Java
18
star
12

ESP32-HOMEKIT-GATEWAY

ESP32-HOMEKIT-GATEWAY
9
star
13

mixiaoxiao.github.io

CSS
4
star
14

DataStateContainer

DataStateContainer是一个专为处理数据刷新/加载逻辑业务(如微博信息流)而生的ViewGroup。
Java
3
star
15

ActionMenu

A lite library to show an action-menubar like the menus(copy, select all, paste) for UILabel in iOS.
Java
3
star
16

PathScroller

A Scroller that can compute the "value - time" by a Path. 一个依据Path来映射“数值-时间”关系的Scroller,可轻松实现速率变化复杂的Scroll效果。
Java
2
star
17

ZoneAssistiveTouch_TranslationProject

ZoneAssistiveTouch TranslationProject
2
star