RxJava RxBinding 按钮(Button) 点击(click)

简介: /********************************************************************* * RxJava RxBinding 按钮(Button) 点击(click) * 说明: * 之前看了RxJava相关内容,但对于本人来说目前更倾向于从使用中来学 * 习,结果发现找个Button点击的示例都没找到,刚刚在google上找到这两篇 * 文章中有介绍,记录一下。
/*********************************************************************
 *             RxJava RxBinding 按钮(Button) 点击(click)
 * 说明:
 *     之前看了RxJava相关内容,但对于本人来说目前更倾向于从使用中来学
 * 习,结果发现找个Button点击的示例都没找到,刚刚在google上找到这两篇
 * 文章中有介绍,记录一下。
 *
 *                                    2016-9-8 深圳 南山平山村 曾剑锋
 ********************************************************************/

一、参考文档:
    1. RxJava
        https://guides.codepath.com/android/RxJava
    2. RxJava and RxBinding
        https://guides.codepath.com/android/RxJava-and-RxBinding#overview

二、配置:
    相关配置请参考《参考文档》里的两篇文档。

三、Button示例:
    Button button = (Button)findViewById(R.id.button);
    Subscription buttonSub = RxView.clicks(button).subscribe(new Action1<Void>() {
        @Override
        public void call(Void aVoid) {
            //handle on click here
        }
    }); 
        
四、EditText示例:
    EditText editText = (EditText)findViewById(R.id.editText);
    Subscription editTextSub = RxTextView.textChanges(editText).subscribe(new Action1<String>() {
        @Override
        public void call(String value) {
           // do some work with new text
        }
    });

 

目录
相关文章
|
9月前
解决点击button按钮会刷新页面的问题
解决点击button按钮会刷新页面的问题
72 0
el-popover 点击取消按钮,弹窗仍然无法关闭
el-popover 点击取消按钮,弹窗仍然无法关闭
|
9月前
|
移动开发 小程序 JavaScript
uView Button 按钮
uView Button 按钮
178 2
|
JavaScript
element-ui的popover弹出框点击取消
element-ui的popover弹出框点击取消
299 1
|
小程序
button按钮组件
button按钮组件
108 0
element-ui框架的el-dialog弹出框被遮罩层挡住了
element-ui框架的el-dialog弹出框被遮罩层挡住了
365 0
element-ui框架的el-dialog弹出框被遮罩层挡住了
|
iOS开发
SwiftUI极简教程08: Button按钮的使用
SwiftUI极简教程08: Button按钮的使用
1377 0
SwiftUI极简教程08: Button按钮的使用
html+css实战37-按钮button
html+css实战37-按钮button
112 0
html+css实战37-按钮button
element ui confirm弹窗自定义样式小知识
element ui confirm弹窗自定义样式小知识
1823 0
SwiftUI—Button按钮控件的使用
SwiftUI—Button按钮控件的使用
536 0
SwiftUI—Button按钮控件的使用

热门文章

最新文章