本文整理汇总了Java中android.view.View.setWillNotDraw方法的典型用法代码示例。如果您正苦于以下问题:Java View.setWillNotDraw方法的具体用法?Java View.setWillNotDraw怎么用?Java View.setWillNotDraw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setWillNotDraw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fuckView
import android.view.View; //导入方法依赖的package包/类
private static void fuckView(View v, boolean shouldVisibility) {
if (shouldVisibility)
v.setVisibility(View.GONE);
v.setWillNotDraw(true);
ViewGroup.LayoutParams layoutParams = v.getLayoutParams();
layoutParams.height = 0;
layoutParams.width = 0;
v.setPadding(0, 0, 0, 0);
v.setMinimumHeight(0);
v.setMinimumWidth(0);
v.setBackgroundColor(Color.TRANSPARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
v.setAlpha(0f);
}
v.setLayoutParams(layoutParams);
v.clearAnimation();
}
示例2: 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();
}
}
}
示例3: PercentClipHelper
import android.view.View; //导入方法依赖的package包/类
PercentClipHelper(@NonNull View view, @Nullable AttributeSet attrs) {
this.view = view;
this.params = new ClipParams(view.getContext(), attrs);
this.paint = new Paint(Paint.ANTI_ALIAS_FLAG);
this.maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
this.maskPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
view.setWillNotDraw(false);
}
示例4: onAttachedToWindow
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
LayoutParams layoutParams =
new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
int coordinatorLayoutOffset = getResources().getDimensionPixelSize(R.dimen.coordinator_layout_offset);
if (fabGravity == BOTTOM_END || fabGravity == TOP_END) {
layoutParams.setMargins(0, 0, coordinatorLayoutOffset, 0);
} else {
layoutParams.setMargins(coordinatorLayoutOffset, 0, 0, 0);
}
menuItemsLayout.setLayoutParams(layoutParams);
// Needed in order to intercept key events
setFocusableInTouchMode(true);
if (useTouchGuard) {
ViewParent parent = getParent();
touchGuard = new View(getContext());
touchGuard.setOnClickListener(this);
touchGuard.setWillNotDraw(true);
touchGuard.setVisibility(GONE);
if (touchGuardDrawable != null) {
touchGuard.setBackground(touchGuardDrawable);
}
if (parent instanceof FrameLayout) {
FrameLayout frameLayout = (FrameLayout) parent;
frameLayout.addView(touchGuard, frameLayout.indexOfChild(this));
} else if (parent instanceof CoordinatorLayout) {
CoordinatorLayout coordinatorLayout = (CoordinatorLayout) parent;
coordinatorLayout.addView(touchGuard, coordinatorLayout.indexOfChild(this));
} else if (parent instanceof RelativeLayout) {
((RelativeLayout) parent).addView(
touchGuard, ((RelativeLayout) parent).indexOfChild(this),
new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
} else {
Log.d(TAG, "touchGuard requires that the parent of this FabSpeedDialer be a FrameLayout or RelativeLayout");
}
}
setOnClickListener(this);
}
示例5: onAttachedToWindow
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
LayoutParams layoutParams =
new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
int coordinatorLayoutOffset = getResources().getDimensionPixelSize(R.dimen.coordinator_layout_offset);
if (fabGravity == BOTTOM_END || fabGravity == TOP_END) {
layoutParams.setMargins(0, 0, coordinatorLayoutOffset, 0);
} else {
layoutParams.setMargins(coordinatorLayoutOffset, 0, 0, 0);
}
menuItemsLayout.setLayoutParams(layoutParams);
// Set up the client's FAB
fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setImageDrawable(fabDrawable);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
fab.setImageTintList(fabDrawableTint);
}
if (fabBackgroundTint != null) {
fab.setBackgroundTintList(fabBackgroundTint);
}
fab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (isAnimating) return;
if (isMenuOpen()) {
closeMenu();
} else {
openMenu();
}
}
});
// Needed in order to intercept key events
setFocusableInTouchMode(true);
if (useTouchGuard) {
ViewParent parent = getParent();
touchGuard = new View(getContext());
touchGuard.setOnClickListener(this);
touchGuard.setWillNotDraw(true);
touchGuard.setVisibility(GONE);
if (touchGuardDrawable != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
touchGuard.setBackground(touchGuardDrawable);
} else {
touchGuard.setBackgroundDrawable(touchGuardDrawable);
}
}
if (parent instanceof FrameLayout) {
FrameLayout frameLayout = (FrameLayout) parent;
frameLayout.addView(touchGuard);
bringToFront();
} else if (parent instanceof CoordinatorLayout) {
CoordinatorLayout coordinatorLayout = (CoordinatorLayout) parent;
coordinatorLayout.addView(touchGuard);
bringToFront();
} else if (parent instanceof RelativeLayout) {
RelativeLayout relativeLayout = (RelativeLayout) parent;
relativeLayout.addView(touchGuard,
new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
bringToFront();
} else {
Log.d(TAG, "touchGuard requires that the parent of this FabSpeedDialer be a FrameLayout or RelativeLayout");
}
}
setOnClickListener(this);
if (shouldOpenMenu)
openMenu();
}