0

使用rxBindings我试图减慢点击事件,但我想知道需要什么参数。

例如,这是我在 imageview 上做的一个电话。所以 ImageView v;

RxView.clicks(v)
                  .throttleFirst(400, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
                  .subscribe(new Consumer<Object>() {

                      @Override
                      public void accept(@io.reactivex.annotations.NonNull Object v) throws Exception {
                          showBottomSheet(getAdapterPosition());
                      }
                  });

              but im im not sure what the parameter in accept should be ?  

              I was expecting i would get the view here but when i try changing the type to View i get an error of no such method.
4

1 回答 1

1

如果你查看generate using的源代码,你会看到当点击发生时,会触发以下代码:ObservableRxView.clicks()

observer.onNext(Notification.INSTANCE);

在库中定义为:

public enum Notification {
  INSTANCE
}

它只是表示事件发生的一种方便方式,它不携带任何额外信息。

于 2017-07-07T10:24:23.743 回答