當前位置: 首頁>>代碼示例>>Java>>正文


Java View.setWillNotDraw方法代碼示例

本文整理匯總了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();
        }
 
開發者ID:w568w,項目名稱:fuckView,代碼行數:21,代碼來源:Hook.java

示例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();
        }
    }
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:40,代碼來源:ForegroundDelegate.java

示例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);
}
 
開發者ID:pine,項目名稱:PercentClipView,代碼行數:9,代碼來源:PercentClipHelper.java

示例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);
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:48,代碼來源:FabSpeedDial.java

示例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();
}
 
開發者ID:Alcatraz323,項目名稱:MaterialOCR,代碼行數:81,代碼來源:FabSpeedDial.java


注:本文中的android.view.View.setWillNotDraw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。