本文整理匯總了Java中android.view.ViewTreeObserver.removeOnPreDrawListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewTreeObserver.removeOnPreDrawListener方法的具體用法?Java ViewTreeObserver.removeOnPreDrawListener怎麽用?Java ViewTreeObserver.removeOnPreDrawListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.ViewTreeObserver
的用法示例。
在下文中一共展示了ViewTreeObserver.removeOnPreDrawListener方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPreDraw
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override public boolean onPreDraw() {
ImageView target = this.target.get();
if (target == null) {
return true;
}
ViewTreeObserver vto = target.getViewTreeObserver();
if (!vto.isAlive()) {
return true;
}
int width = target.getWidth();
int height = target.getHeight();
if (width <= 0 || height <= 0 || target.isLayoutRequested()) {
return true;
}
target.removeOnAttachStateChangeListener(this);
vto.removeOnPreDrawListener(this);
this.target.clear();
this.creator.unfit().resize(width, height).into(target, callback);
return true;
}
示例2: cancel
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
void cancel() {
creator.clearTag();
callback = null;
ImageView target = this.target.get();
if (target == null) {
return;
}
this.target.clear();
target.removeOnAttachStateChangeListener(this);
ViewTreeObserver vto = target.getViewTreeObserver();
if (vto.isAlive()) {
vto.removeOnPreDrawListener(this);
}
}
示例3: clearCallbacksAndListener
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
void clearCallbacksAndListener() {
// Keep a reference to the layout listener and remove it here
// rather than having the observer remove itself because the observer
// we add the listener to will be almost immediately merged into
// another observer and will therefore never be alive. If we instead
// keep a reference to the listener and remove it here, we get the
// current view tree observer and should succeed.
ViewTreeObserver observer = view.getViewTreeObserver();
if (observer.isAlive()) {
observer.removeOnPreDrawListener(layoutListener);
}
layoutListener = null;
cbs.clear();
}
示例4: clearCallbacksAndListener
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
void clearCallbacksAndListener() {
// Keep a reference to the layout attachStateListener and remove it here
// rather than having the observer remove itself because the observer
// we add the attachStateListener to will be almost immediately merged into
// another observer and will therefore never be alive. If we instead
// keep a reference to the attachStateListener and remove it here, we get the
// current view tree observer and should succeed.
ViewTreeObserver observer = view.getViewTreeObserver();
if (observer.isAlive()) {
observer.removeOnPreDrawListener(layoutListener);
}
layoutListener = null;
cbs.clear();
}
示例5: onDetachedFromWindow
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override
protected void onDetachedFromWindow() {
if (mGlobalListenersAdded) {
ViewTreeObserver observer = getViewTreeObserver();
observer.removeOnScrollChangedListener(mScrollChangedListener);
observer.removeOnPreDrawListener(mDrawListener);
mGlobalListenersAdded = false;
}
mRequestedVisible = false;
updateWindow(false, false);
mLayout.token = null;
super.onDetachedFromWindow();
}
示例6: onPreDraw
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override
public boolean onPreDraw() {
if (!hasRef()) {
return false;
}
final ViewTreeObserver observer = getWeakRef().get().getViewTreeObserver();
if (observer == null || !observer.isAlive()) {
return false;
}
observer.removeOnPreDrawListener(this);
return onPreDraw(getWeakRef().get());
}
示例7: onDetachedFromWindow
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
resetTouchBehaviors(false);
if (mNeedsPreDrawListener && mOnPreDrawListener != null) {
final ViewTreeObserver vto = getViewTreeObserver();
vto.removeOnPreDrawListener(mOnPreDrawListener);
}
if (mNestedScrollingTarget != null) {
onStopNestedScroll(mNestedScrollingTarget);
}
mIsAttachedToWindow = false;
}
示例8: removePreDrawListener
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
/**
* Remove the pre-draw listener if we're attached to a window and mark that we currently
* do not need it when attached.
*/
void removePreDrawListener() {
if (mIsAttachedToWindow) {
if (mOnPreDrawListener != null) {
final ViewTreeObserver vto = getViewTreeObserver();
vto.removeOnPreDrawListener(mOnPreDrawListener);
}
}
mNeedsPreDrawListener = false;
}