CompoundLayout
来源:互联网 发布:中标麒麟 软件源 编辑:程序博客网 时间:2024/06/06 02:00
项目地址:Jaouan/CompoundLayout
简介:It's an Android library that allows you to use Layout as RadioButton or CheckBox.
It's an Android library that allows you to use Layout as RadioButton or CheckBox. The librarie is Android 14+ compatible. Gradient effect is only Android 21+ compatible.
The demo below is inspired by Cris Samson's gradient hover animation.
Installation
Gradle
repositories { maven { url "https://jitpack.io" }}
compile 'com.github.jaouan:compoundlayout:1.0.1'
Usage
General
CompoundLayout checked state can be changed programmatically using methodmyCompoundLayout.setChecked(). Checked state can be retrieved usingmyCompoundLayout.isChecked(), and can be listened usingmyCompoundLayout.setOnCheckedChangeListener().
Layout as CheckBox
<com.jaouan.compoundlayout.CompoundLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a_beautiful_selector" app:checked="true" > <!-- Checked or not --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Lorem ipsum" /></com.jaouan.compoundlayout.CompoundLayout>
Layout as RadioButton
Basic
<com.jaouan.compoundlayout.RadioLayoutGroup android:layout_width="wrap_content" android:layout_height="wrap_content" app:orientation="horizontal"> <!-- Orientation : vertical or horizontal --> <com.jaouan.compoundlayout.RadioLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a_beautiful_selector" app:checked="true"> <!-- Checked or not --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Lorem ipsum" /> </com.jaouan.compoundlayout.RadioLayout> <com.jaouan.compoundlayout.RadioLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a_beautiful_selector"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Lorem ipsum" /> </com.jaouan.compoundlayout.RadioLayout></com.jaouan.compoundlayout.RadioLayoutGroup>
Gradient effect (Android 21+ only)
<com.jaouan.compoundlayout.RadioLayoutGroup android:layout_width="wrap_content" android:layout_height="wrap_content" app:orientation="horizontal" > <!-- Orientation : vertical or horizontal --> <com.jaouan.compoundlayout.GradientRadioLayout android:layout_width="wrap_content" android:layout_height="wrap_content" app:checked="true" app:angle="45" app:colorA="#AAFFA726" app:colorB="#AAEC407A"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Lorem ipsum" /> </com.jaouan.compoundlayout.GradientRadioLayout> <!-- Circle clipped --> <com.jaouan.compoundlayout.CircleGradientRadioLayout android:layout_width="wrap_content" android:layout_height="wrap_content" app:angle="70" app:colorA="#AAFFA726" app:colorB="#AAEC407A"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Lorem ipsum" /> </com.jaouan.compoundlayout.CircleGradientRadioLayout></com.jaouan.compoundlayout.RadioLayoutGroup>
0 0
- CompoundLayout
- android 的刷新库
- 对Jquery DataTables的学习(一)
- [leetcode] 357. Count Numbers with Unique Digits
- 谈谈网络编程中应用层(基于TCP/UDP)的协议设计 [帧设计]
- 一个iOS模块化开发解决方案
- CompoundLayout
- 欧拉计划(鱼C论坛)@20161107
- Spring中WEB.xml配置总结
- jdbc调用存储过程
- Android 下插件补丁的开发框架
- 2345.com 强制占用主页清理
- example
- 使用pull方法解析Xml文件(省市县Xml)
- 将Android项目发布到Jcenter