【效果图】
![](https://img.haomeiwen.com/i3793005/469e9a7139e2aa6c.png)
(1) 自己写的类,实现多个按钮的单击事件:
(方法一:)
//文字
public voidsetTextViewIsSelcted(TextView[] btnArray){
for(inti =0;i < btnArray.length;i++){
if(btnArray[i].isPressed()){
//按钮被选中
btnArray[i].setTextColor(Color.WHITE);//白色
}else{
btnArray[i].setTextColor(Color.GRAY);//灰色
}
}
}
(方法二:)
//相对布局
public voidsetRelativeLayoutIsSelcted(RelativeLayout[] btnArray){
for(inti =0;i < btnArray.length;i++){
if(btnArray[i].isPressed()){
//按钮被选中
btnArray[i].setBackgroundResource(R.drawable.m_rounded_rect_my_wallet_text_red);//绿色
}else{
btnArray[i].setBackgroundResource(R.drawable.m_rounded_rect_my_wallet_text_white);//白色
}
}
}
【Bug】可以同时点击多个按钮(原因: 可以同时调用同一个按钮方法)
(2)
【解决方案】 使用RxBinding (结合RXJava)
blog.csdn.net/u011686167/article/details/53433552
github地址: github.com/JakeWharton
(3)解决多点触碰:
![](https://img.haomeiwen.com/i3793005/825e5be6bd603156.jpg)
网友评论