微调器的 RxBindings?
RxBindings For Spinner?
我是新手 android 和 rxjava。我经历过很多使用 rxbindings 监听事件的例子。比如这个
RxView.clicks(b).subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
// do some work here
}
});
或
RxTextView.textChanges(name)
.subscribe(new Action1<String>() {
@Override
public void call(String value) {
// do some work with the updated text
}
});
现在我正在尝试对 android 微调器执行相同的操作。我想听 itemselected 事件。有人可以帮忙吗?
The items in the Spinner come from the Adapter associated with this
view.
See the Spinners guide.
To define the selection event handler for a spinner, implement the
AdapterView.OnItemSelectedListener interface and the corresponding
onItemSelected() callback method. For example, here's an
implementation of the interface in an Activity:
文档:https://developer.android.com/guide/topics/ui/controls/spinner.html
在 GitHub-Repository 中搜索 Spinner 后,我找到了 Spinner 的示例:
RxAdapterView.itemSelections(spinner)
.subscribeOn(AndroidSchedulers.mainThread())
.subscribe(integer -> {
Log.v("spinner", integer.toString());
});
我是新手 android 和 rxjava。我经历过很多使用 rxbindings 监听事件的例子。比如这个
RxView.clicks(b).subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
// do some work here
}
});
或
RxTextView.textChanges(name)
.subscribe(new Action1<String>() {
@Override
public void call(String value) {
// do some work with the updated text
}
});
现在我正在尝试对 android 微调器执行相同的操作。我想听 itemselected 事件。有人可以帮忙吗?
The items in the Spinner come from the Adapter associated with this view.
See the Spinners guide.
To define the selection event handler for a spinner, implement the AdapterView.OnItemSelectedListener interface and the corresponding onItemSelected() callback method. For example, here's an implementation of the interface in an Activity:
文档:https://developer.android.com/guide/topics/ui/controls/spinner.html
在 GitHub-Repository 中搜索 Spinner 后,我找到了 Spinner 的示例:
RxAdapterView.itemSelections(spinner)
.subscribeOn(AndroidSchedulers.mainThread())
.subscribe(integer -> {
Log.v("spinner", integer.toString());
});