Open siliconprime-thanhduc opened 5 years ago
Khi ta cần detect layout change trước đây ta thường dùng
myView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { } });
Chúng ta có thể dùng RxView để làm việc này 1 cách dễ dàng hơn:
RxView.globalLayouts(info_overlay) .map { info_overlay.visibility } .distinct() .subscribe { newVisibility -> }
hoặc
RxView.layoutChanges(view) .distinct() .subscribe { newVisibility -> }
Khi ta cần detect layout change trước đây ta thường dùng
Chúng ta có thể dùng RxView để làm việc này 1 cách dễ dàng hơn:
hoặc