本文整理匯總了Java中android.view.View.unscheduleDrawable方法的典型用法代碼示例。如果您正苦於以下問題:Java View.unscheduleDrawable方法的具體用法?Java View.unscheduleDrawable怎麽用?Java View.unscheduleDrawable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.View
的用法示例。
在下文中一共展示了View.unscheduleDrawable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setForeground
import android.view.View; //導入方法依賴的package包/類
/**
* Supply a Drawable that is to be rendered on top of all of the child
* views in the frame layout. Any padding in the Drawable will be taken
* into account by ensuring that the children are inset to be placed
* inside of the padding area.
*
* @param drawable The Drawable to be drawn on top of the children.
*/
public void setForeground(View view, Drawable drawable) {
if (view != null) {
if (mForeground != drawable) {
if (mForeground != null) {
mForeground.setCallback(null);
view.unscheduleDrawable(mForeground);
}
mForeground = drawable;
if (drawable != null) {
view.setWillNotDraw(false);
drawable.setCallback(view);
if (drawable.isStateful()) {
drawable.setState(view.getDrawableState());
}
if (mForegroundGravity == Gravity.FILL) {
Rect padding = new Rect();
drawable.getPadding(padding);
}
//update bounds
updateBounds(view, drawable);//added by song
} else {
view.setWillNotDraw(true);
}
view.requestLayout();
view.invalidate();
}
}
}
示例2: unscheduleDrawable
import android.view.View; //導入方法依賴的package包/類
@Override
public void unscheduleDrawable(final Drawable who, final Runnable what) {
for (int i = 0; i < mViewList.size(); i++) {
final ViewWeakReference reference = mViewList.get(i);
final View view = reference.get();
if (view != null) {
view.unscheduleDrawable(who);
} else {
// Always remove null references to reduce Set size
mViewList.remove(reference);
}
}
}