首先需要导入这个库,在此感谢作者
https://github.com/ChadCSong/ShineButton这是图片效果
https://github.com/ChadCSong/ShineButton/blob/master/demo_small.gif
- 利用这个肯定是要放到listview或者GrideView中的!
- 首先自己开源先试一下这个控件
- 我这里就是简单的使用了下,就是用了该作者的属性
- 在listview中的adapter使用,需要在item的根布局中,设置事件属性
- android:descendantFocusability=”blocksDescendants” 这个不多说的属性…
- 然后在adapter中初始化控件,
ShineButton sh_btn1 = (ShineButton) view.findViewById(R.id.sh_btn1);
ShineButton sh_btn2 = (ShineButton) view.findViewById(R.id.sh_btn2);
// 下面的这2句话必须要添加上!否则没有点击事件!!!
sh_btn1.init(MainActivity.this);
sh_btn2.init(MainActivity.this);
// 然后就是点击事件的处理
sh_btn1.setOnClickListener(...)
sh_btn2.setOnClickListener(...)
- 在来就是介绍里面一些属性的简单使用
app:enable_flashing="true" // true 表示按下是闪光的效果 ,false表示正常的效果
app:siShape="@raw/ic_action_thumb_up" //需要将图片放到raw文件下,有的图片放里面可能会使图片变模糊,所以要搞好一点的图片 :)
app:btn_fill_color="#FF6666" // 表示按下后,将图片全部填充成红色
- 应用下载地址 [http://download.youkuaiyun.com/detail/buttonxin/9618369] (http://download.youkuaiyun.com/detail/buttonxin/9618369) 里面要把配置文件中的activity切换成MainActivity!!! 嘿嘿