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


Java ViewOutlineProvider類代碼示例

本文整理匯總了Java中android.view.ViewOutlineProvider的典型用法代碼示例。如果您正苦於以下問題:Java ViewOutlineProvider類的具體用法?Java ViewOutlineProvider怎麽用?Java ViewOutlineProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ViewOutlineProvider類屬於android.view包,在下文中一共展示了ViewOutlineProvider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import android.view.ViewOutlineProvider; //導入依賴的package包/類
/**
     * This method initiates the bottomNavigationBar and handles layout related values
     */
    private void init() {

//        MarginLayoutParams marginParams = new ViewGroup.MarginLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) getContext().getResources().getDimension(R.dimen.bottom_navigation_padded_height)));
//        marginParams.setMargins(0, (int) getContext().getResources().getDimension(R.dimen.bottom_navigation_top_margin_correction), 0, 0);

        setLayoutParams(new ViewGroup.LayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)));

        LayoutInflater inflater = LayoutInflater.from(getContext());
        View parentView = inflater.inflate(R.layout.bottom_navigation_bar_container, this, true);
        mBackgroundOverlay = (FrameLayout) parentView.findViewById(R.id.bottom_navigation_bar_overLay);
        mContainer = (FrameLayout) parentView.findViewById(R.id.bottom_navigation_bar_container);
        mTabContainer = (LinearLayout) parentView.findViewById(R.id.bottom_navigation_bar_item_container);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            this.setOutlineProvider(ViewOutlineProvider.BOUNDS);
        } else {
            //to do
        }

        ViewCompat.setElevation(this, mElevation);
        setClipToPadding(false);
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:BottomNavigationBar.java

示例2: HeaderElevationController

import android.view.ViewOutlineProvider; //導入依賴的package包/類
HeaderElevationController(View header) {
    mHeader = header;
    final Resources res = mHeader.getContext().getResources();
    mMaxElevation = res.getDimension(R.dimen.all_apps_header_max_elevation);
    mScrollToElevation = res.getDimension(R.dimen.all_apps_header_scroll_to_elevation);

    // We need to provide a custom outline so the shadow only appears on the bottom edge.
    // The top, left and right edges are all extended out, and the shadow is clipped
    // by the parent.
    final ViewOutlineProvider vop = new ViewOutlineProvider() {
        @Override
        public void getOutline(View view, Outline outline) {
            final View parent = (View) mHeader.getParent();

            final int left = parent.getLeft(); // Use the parent to account for offsets
            final int top = view.getTop();
            final int right = left + view.getWidth();
            final int bottom = view.getBottom();

            final int offset = Utilities.pxFromDp(mMaxElevation, res.getDisplayMetrics());
            outline.setRect(left - offset, top - offset, right + offset, bottom);
        }
    };
    mHeader.setOutlineProvider(vop);
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:26,代碼來源:HeaderElevationController.java

示例3: onSizeChanged

import android.view.ViewOutlineProvider; //導入依賴的package包/類
@Override
protected void onSizeChanged(final int w, final int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    mDrawable.setBounds(0, 0, w, h);
    mWidth = w;
    mHeight = h;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setOutlineProvider(new ViewOutlineProvider() {
            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(0, 0, view.getWidth(), view.getHeight());
            }
        });
        setClipToOutline(true);
    }
}
 
開發者ID:dibakarece,項目名稱:DMAudioStreamer,代碼行數:19,代碼來源:PlayPauseView.java

示例4: initView

import android.view.ViewOutlineProvider; //導入依賴的package包/類
private void initView(AttributeSet attrs) {

        edgePaint.setColor(DEFAULT_EDGE_COLOR);
        edgePaint.setAntiAlias(true);
        if (attrs != null) {
            TypedArray arr = getContext().obtainStyledAttributes(attrs, R.styleable.DepthView);
            edgePaint.setColor(arr.getInt(R.styleable.DepthView_edge_color, DEFAULT_EDGE_COLOR));
            setIsCircle(arr.getBoolean(R.styleable.DepthView_is_circle, false));
            depth = arr.getDimension(R.styleable.DepthView_depth, DEFAULT_THICKNESS * getResources().getDisplayMetrics().density);
            customShadowElevation = arr.getDimension(R.styleable.DepthView_custom_elevation, 0);
        } else {
            edgePaint.setColor(DEFAULT_EDGE_COLOR);
            depth = DEFAULT_THICKNESS * getResources().getDisplayMetrics().density;
        }
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {

            }
        });
    }
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:22,代碼來源:DepthLayout.java

示例5: initView

import android.view.ViewOutlineProvider; //導入依賴的package包/類
private void initView(AttributeSet attrs) 
{

       edgePaint.setColor(DEFAULT_EDGE_COLOR);
       edgePaint.setAntiAlias(true);
       if (attrs != null)
	{
           TypedArray arr = getContext().obtainStyledAttributes(attrs, R.styleable.DepthView);
           edgePaint.setColor(arr.getInt(R.styleable.DepthView_edge_color, DEFAULT_EDGE_COLOR));
           setIsCircle(arr.getBoolean(R.styleable.DepthView_is_circle, false));
           depth = arr.getDimension(R.styleable.DepthView_depth, DEFAULT_THICKNESS * getResources().getDisplayMetrics().density);
           customShadowElevation = arr.getDimension(R.styleable.DepthView_custom_elevation, 0);
       }
	else
	{
           edgePaint.setColor(DEFAULT_EDGE_COLOR);
           depth = DEFAULT_THICKNESS * getResources().getDisplayMetrics().density;
       }
	
       setOutlineProvider(new ViewOutlineProvider() 
	{
		@Override
		public void getOutline(View view, Outline outline)
		{ }
	});
   }
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:27,代碼來源:DepthFAB.java

示例6: createFillDrawable

import android.view.ViewOutlineProvider; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Drawable createFillDrawable() {
    StateListDrawable drawable = new StateListDrawable();
    drawable.addState(new int[]{-android.R.attr.state_enabled}, createCircleDrawable(mColorDisabled));
    drawable.addState(new int[]{android.R.attr.state_pressed}, createCircleDrawable(mColorPressed));
    drawable.addState(new int[]{}, createCircleDrawable(mColorNormal));

    if (Util.hasLollipop()) {
        RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][]{{}},
                new int[]{mColorRipple}), drawable, null);
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(0, 0, view.getWidth(), view.getHeight());
            }
        });
        setClipToOutline(true);
        mBackgroundDrawable = ripple;
        return ripple;
    }

    mBackgroundDrawable = drawable;
    return drawable;
}
 
開發者ID:WeiMei-Tian,項目名稱:editor-sql,代碼行數:25,代碼來源:FloatingActionButton.java

示例7: createFillDrawable

import android.view.ViewOutlineProvider; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Drawable createFillDrawable() {
    StateListDrawable drawable = new StateListDrawable();
    drawable.addState(new int[]{android.R.attr.state_pressed}, createRectDrawable(mColorPressed));
    drawable.addState(new int[]{}, createRectDrawable(mColorNormal));

    if (Util.hasLollipop()) {
        RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][]{{}},
                new int[]{mColorRipple}), drawable, null);
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(0, 0, view.getWidth(), view.getHeight());
            }
        });
        setClipToOutline(true);
        mBackgroundDrawable = ripple;
        return ripple;
    }

    mBackgroundDrawable = drawable;
    return drawable;
}
 
開發者ID:WeiMei-Tian,項目名稱:editor-sql,代碼行數:24,代碼來源:Label.java

示例8: initView

import android.view.ViewOutlineProvider; //導入依賴的package包/類
private void initView(AttributeSet attrs) {

        setLayerType(LAYER_TYPE_HARDWARE, null);

        edgePaint.setColor(DEFAULT_EDGE_COLOR);
        edgePaint.setAntiAlias(true);
        if (attrs != null) {
            TypedArray arr = getContext().obtainStyledAttributes(attrs, R.styleable.DepthRelativeLayout);
            edgePaint.setColor(arr.getInt(R.styleable.DepthRelativeLayout_depth_edgeColor, DEFAULT_EDGE_COLOR));
            setIsCircle(arr.getBoolean(R.styleable.DepthRelativeLayout_depth_isCircle, false));
            depth = arr.getDimension(R.styleable.DepthRelativeLayout_depth_value, DEFAULT_THICKNESS * getResources().getDisplayMetrics().density);
            depthIndex = arr.getInteger(R.styleable.DepthRelativeLayout_depth_zIndex, depthIndex);
            animationDelay = arr.getInteger(R.styleable.DepthRelativeLayout_depth_animationDelay, animationDelay);
            customShadowElevation = arr.getDimension(R.styleable.DepthRelativeLayout_depth_elevation, 0);
        } else {
            edgePaint.setColor(DEFAULT_EDGE_COLOR);
            depth = DEFAULT_THICKNESS * getResources().getDisplayMetrics().density;
        }
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {

            }
        });
    }
 
開發者ID:florent37,項目名稱:Depth,代碼行數:26,代碼來源:DepthRelativeLayout.java

示例9: getOutlineProvider

import android.view.ViewOutlineProvider; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public ViewOutlineProvider getOutlineProvider() {
    shadowpath = new Path();
    if (config.getRadius() == 0) {
        shadowpath = path;
    } else {
        rect = new Rect(0, 0, (int) width, (int) height);
        RectF r = new RectF(rect);
        shadowpath.addRoundRect(r, config.getRadius(), config.getRadius(), Path.Direction.CCW);
        shadowpath.op(path, shadowpath, Path.Op.INTERSECT);
    }
    return new ViewOutlineProvider() {
        @Override
        public void getOutline(View view, Outline outline) {
            if (path.isConvex()) {
                outline.setConvexPath(shadowpath);
            }
        }
    };
}
 
開發者ID:akshay2211,項目名稱:Oblique,代碼行數:22,代碼來源:ObliqueView.java

示例10: initialize

import android.view.ViewOutlineProvider; //導入依賴的package包/類
private void initialize() {

        borderPath = new Path();
        oval = new RectF();

        borderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        borderPaint.setStyle(Paint.Style.STROKE);

        // ViewOutlineProvider does not support clipping customized path
        if (canUseViewOutlineProvider()) {
            ViewOutlineProvider provider = new ViewOutlineProvider() {
                @Override
                public void getOutline(View view, Outline outline) {

                    if (canUseViewOutlineProvider()) {
                        float radius = Math.max(0, cornerRadius);
                        outline.setRoundRect(0, 0, getWidth(), getHeight(), radius);
                    }
                }
            };

            setOutlineProvider(provider);
            setClipToOutline(true);
        }
    }
 
開發者ID:QuarkWorks,項目名稱:RoundedFrameLayout-Android,代碼行數:26,代碼來源:RoundedFrameLayout.java

示例11: createFillDrawable

import android.view.ViewOutlineProvider; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Drawable createFillDrawable() {
    StateListDrawable drawable = new StateListDrawable();
    drawable.addState(new int[]{-android.R.attr.state_enabled}, createCircleDrawable(mColorDisabled));
    drawable.addState(new int[]{android.R.attr.state_pressed}, createCircleDrawable(mColorPressed));
    drawable.addState(new int[]{}, createCircleDrawable(mColorNormal));

    if (!isInEditMode() && Util.hasLollipop()) {
        RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][]{{}},
                new int[]{mColorRipple}), drawable, null);
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(0, 0, view.getWidth(), view.getHeight());
            }
        });
        setClipToOutline(true);
        mBackgroundDrawable = ripple;
        return ripple;
    }

    mBackgroundDrawable = drawable;
    return drawable;
}
 
開發者ID:AndroidDeveloperLB,項目名稱:FloatingActionButtonEx,代碼行數:25,代碼來源:FloatingActionButton.java

示例12: ForegroundRelativeLayout

import android.view.ViewOutlineProvider; //導入依賴的package包/類
public ForegroundRelativeLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.ForegroundView);

    final Drawable drawable = a.getDrawable(
            R.styleable.ForegroundView_android_foreground);
    if (drawable != null) {
        setForeground(drawable);
    }
    a.recycle();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setOutlineProvider(ViewOutlineProvider.BOUNDS);
    }
}
 
開發者ID:drakeet,項目名稱:Lunei,代碼行數:17,代碼來源:ForegroundRelativeLayout.java

示例13: createFillDrawable

import android.view.ViewOutlineProvider; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Drawable createFillDrawable() {
    StateListDrawable drawable = new StateListDrawable();
    drawable.addState(new int[] {android.R.attr.state_pressed},
            createRectDrawable(mColorPressed)
    );
    drawable.addState(new int[] {}, createRectDrawable(mColorNormal));

    if(Util.hasLollipop() && mUsingRipple) {
        RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][] {{}},
                new int[] {mColorRipple}
        ), drawable, null);
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(0, 0, view.getWidth(), view.getHeight());
            }
        });
        setClipToOutline(true);
        mBackgroundDrawable = ripple;
        return ripple;
    }

    mBackgroundDrawable = drawable;
    return drawable;
}
 
開發者ID:tpb1908,項目名稱:AndroidProjectsClient,代碼行數:27,代碼來源:Label.java

示例14: initOutlineProvider

import android.view.ViewOutlineProvider; //導入依賴的package包/類
private void initOutlineProvider() {
  if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
    setOutlineProvider(
        new ViewOutlineProvider() {
          @Override
          @TargetApi(Build.VERSION_CODES.LOLLIPOP)
          public void getOutline(View view, Outline outline) {
            if (chipDrawable != null) {
              chipDrawable.getOutline(outline);
            } else {
              outline.setAlpha(0.0f);
            }
          }
        });
  }
}
 
開發者ID:material-components,項目名稱:material-components-android,代碼行數:17,代碼來源:Chip.java

示例15: initialize

import android.view.ViewOutlineProvider; //導入依賴的package包/類
private void initialize() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setOutlineProvider(new ViewOutlineProvider() {
            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(
                        view.getPaddingLeft(),
                        view.getPaddingTop(),
                        view.getWidth() - view.getPaddingRight(),
                        view.getHeight() - view.getPaddingBottom());
            }
        });
        setClipToOutline(true);
    }
}
 
開發者ID:WangDaYeeeeee,項目名稱:Mysplash,代碼行數:17,代碼來源:CircleImageView.java


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