switchbutton
switchbutton copied to clipboard
iOS风格SwitchButton。 只涉及到一个类文件,异常容易集成进入你的项目。支持开关的"延时和回滚"操作。only one class file, very easy to integrate into your program. support the delay operation and rolling b...
@iielse Hello,I added this dependency: - `build.gradle(:app)` ```shell implementation 'com.github.iielse:switchbutton:1.0.4' ``` I added this component to the xml, and then reported an error:  The error message is as follows:...
如题,希望能加上该功能,3Q。
```kotlin switcher.setOnStateChangedListener(object : SwitchView.OnStateChangedListener { override fun toggleToOn(view: SwitchView?) { viewModel.doSomethingAsync(1) } override fun toggleToOff(view: SwitchView?) { viewModel.doSomethingAsync(0) } }) viewModel.state.observe(this) { switcher.setOpen(it) } ``` 如上场景,`doSomethingAsync`里会异步执行网络请求,如果请求成功会更新`state` (这是一个LiveData),更新成功后再通过observe 更新 open 状态。这是一个很正常的流程。...