当前位置: 首页>>代码示例>>Java>>正文


Java ClipDrawable.HORIZONTAL属性代码示例

本文整理汇总了Java中android.graphics.drawable.ClipDrawable.HORIZONTAL属性的典型用法代码示例。如果您正苦于以下问题:Java ClipDrawable.HORIZONTAL属性的具体用法?Java ClipDrawable.HORIZONTAL怎么用?Java ClipDrawable.HORIZONTAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.graphics.drawable.ClipDrawable的用法示例。


在下文中一共展示了ClipDrawable.HORIZONTAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RATINGBAR_PROGERSS_DRAWABLE

/** RatingBar 星星 */
public static Drawable RATINGBAR_PROGERSS_DRAWABLE() {
    Drawable[] layers = new Drawable[3];
    Drawable darwable1 = getDrawable(IcomoonIcon.ICON_IC_STAR_NORMAL, NUMBER_3_INT,10,10);
    Drawable darwable2 = getDrawable(IcomoonIcon.ICON_IC_STAR_NORMAL, NUMBER_3_INT,10,10);
    Drawable darwable3 = getDrawable(IcomoonIcon.ICON_IC_STAR_SOLID, NUMBER_3_INT,10,10);
    
    
    layers[0] = darwable1;
    layers[1] = new ClipDrawable(darwable2, Gravity.LEFT, ClipDrawable.HORIZONTAL);
    layers[2] = new ClipDrawable(darwable3, Gravity.LEFT, ClipDrawable.HORIZONTAL);
    LayerDrawable drawable = new LayerDrawable(layers);
    drawable.setId(0, android.R.id.background);
    drawable.setId(1, android.R.id.secondaryProgress);
    drawable.setId(2, android.R.id.progress);
    return drawable;
}
 
开发者ID:cdkd321,项目名称:pure,代码行数:17,代码来源:AppMaterial.java

示例2: buildRatingBarDrawables

private Drawable buildRatingBarDrawables(Bitmap[] images) {
    final int[] requiredIds = { android.R.id.background, android.R.id.secondaryProgress, android.R.id.progress };
    final float[] roundedCorners = new float[] { 5, 5, 5, 5, 5, 5, 5, 5 };
    Drawable[] pieces = new Drawable[3];
    for (int i = 0; i < 3; i++) {

        ShapeDrawable sd = new ShapeDrawable(new RoundRectShape(roundedCorners, null, null));

        BitmapShader bitmapShader = new BitmapShader(images[i], Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
        sd.getPaint().setShader(bitmapShader);

        ClipDrawable cd = new ClipDrawable(sd, Gravity.LEFT, ClipDrawable.HORIZONTAL);
        if (i == 0) {
            pieces[i] = sd;
        } else {
            pieces[i] = cd;
        }
    }
    LayerDrawable ld = new LayerDrawable(pieces);
    for (int i = 0; i < 3; i++) {
        ld.setId(i, requiredIds[i]);
    }
    return ld;
}
 
开发者ID:cdkd321,项目名称:pure,代码行数:24,代码来源:MaterialUtils.java

示例3: applyProgressBarSettings

private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)
                        .width(strokeWidth)
                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
 
开发者ID:philchand,项目名称:mpdroid-2014,代码行数:19,代码来源:DefaultHeaderTransformer.java

示例4: applyProgressBarSettings

private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        final int strokeWidth = mHeaderProgressBar.getResources()
                .getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);

        mHeaderProgressBar.setIndeterminateDrawable(
                new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
                        .color(mProgressDrawableColor)
                        .strokeWidth(strokeWidth)
                        .build());

        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
 
开发者ID:CMPUT301W14T11,项目名称:Team11Prototype,代码行数:19,代码来源:DefaultHeaderTransformer.java

示例5: createSeekBarDrawable

private final LayerDrawable createSeekBarDrawable( int fg_color ) {
    LayerDrawable ld = null;
    try {
        Drawable[] list = new Drawable[2];
        final int bg_color = 0xff9d9e9d;
        GradientDrawable bg = Utils.getShadingEx( atRight ? fg_color : bg_color, 0.6f );
        bg.setCornerRadius( 5 );
        list[0] = bg;
        GradientDrawable fg = Utils.getShadingEx( atRight ? bg_color : fg_color, 0.6f );
        fg.setCornerRadius( 5 );
        list[1] = new ClipDrawable( fg, Gravity.LEFT, ClipDrawable.HORIZONTAL );
        ld = new LayerDrawable( list );
        ld.setId( 0, android.R.id.background );
        ld.setId( 1, android.R.id.progress );
    }
    catch( Exception e ) {
        e.printStackTrace();
    }
    return ld;
}
 
开发者ID:NullNoname,项目名称:ghostcommander-supath,代码行数:20,代码来源:SelZoneDialog.java

示例6: setFilledDrawable

public void setFilledDrawable(Drawable drawable) {
    if (drawable.getConstantState() == null) {
        return;
    }

    ClipDrawable clipDrawable = new ClipDrawable(drawable.getConstantState().newDrawable(), Gravity.START, ClipDrawable.HORIZONTAL);
    mFilledView.setImageDrawable(clipDrawable);
}
 
开发者ID:ome450901,项目名称:SimpleRatingBar,代码行数:8,代码来源:PartialView.java

示例7: setEmptyDrawable

public void setEmptyDrawable(Drawable drawable) {
    if (drawable.getConstantState() == null) {
        return;
    }

    ClipDrawable clipDrawable = new ClipDrawable(drawable.getConstantState().newDrawable(), Gravity.END, ClipDrawable.HORIZONTAL);
    mEmptyView.setImageDrawable(clipDrawable);
}
 
开发者ID:ome450901,项目名称:SimpleRatingBar,代码行数:8,代码来源:PartialView.java

示例8: PSlider_

public PSlider_(AppRunner appRunner) {
    super(appRunner.getAppContext());
    super.setMax(MAX_VALUE);
    // setProgressDrawable(getResources().getDrawable(R.drawable.ui_seekbar_progress));

    mSlider = this;
    // getStyles = new Styler(appRunner, this);

    //Custom background drawable allows you to draw how you want it to look if needed
    // SeekBarBackgroundDrawable backgroundDrawable = new SeekBarBackgroundDrawable(appRunner.getAppContext());
    ColorDrawable progressDrawable = new ColorDrawable(Color.BLUE);
    SeekBarProgressDrawable clipProgressDrawable = new SeekBarProgressDrawable(progressDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL, appRunner.getAppContext());

    ColorDrawable progressDrawable2 = new ColorDrawable(Color.GREEN);
    //Custom seek bar slider drawable. Also allows you to modify appearance.
    InsetDrawable insetDrawable = new InsetDrawable(progressDrawable2, 0, 0, 0, 0);

    Drawable[] drawables = new Drawable[]{ insetDrawable, clipProgressDrawable };

    //Create layer drawables with android pre-defined ids
    LayerDrawable layerDrawable = new LayerDrawable(drawables);
    // layerDrawable.setId(0,android.R.id.background);
    // layerDrawable.setId(1,android.R.id.slider);

    //Set to seek bar
    setThumb(null);
    setProgressDrawable(layerDrawable);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:28,代码来源:PSlider_.java

示例9: refreshDrawable

protected void refreshDrawable(final Drawable drawable) {
	mDrawable = drawable;
	if (mDrawable == null) {
		mDrawable = new ColorDrawable(mColor);
	}
	int gravity = GRAVITY_FILL_VERTICAL | GRAVITY_LEFT;
	int orientation = ClipDrawable.HORIZONTAL;
	switch (mRotation) {
	case 90:
		gravity = GRAVITY_FILL_HORIZONTAL | GRAVITY_BOTTOM;
		orientation = ClipDrawable.VERTICAL;
		break;
	case 180:
		gravity = GRAVITY_FILL_VERTICAL | GRAVITY_RIGHT;
		orientation = ClipDrawable.HORIZONTAL;
		break;
	case 270:
		gravity = GRAVITY_FILL_HORIZONTAL | GRAVITY_TOP;
		orientation = ClipDrawable.VERTICAL;
		break;
	}
	mClipDrawable = new ClipDrawable(mDrawable, gravity, orientation);
	final Rect outRect = new Rect();
	getDrawingRect(outRect);
	mClipDrawable.setBounds(outRect);
	mClipDrawable.setLevel((int)(mProgress * mScale) + mMin);
	postInvalidate();
}
 
开发者ID:saki4510t,项目名称:libcommon,代码行数:28,代码来源:ProgressView.java

示例10: initProgress

private void initProgress(Context context) {
    if (mProgressbar == null) {
        mProgressbar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
        mProgressbar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 12, 0, 0));
        mProgressbar.setMax(100);
        mProgressbar.setProgress(0);
        mProgressbar.setBackgroundColor(0xffcccccc);
        ClipDrawable d = new ClipDrawable(new ColorDrawable(mProgressColor), Gravity.START, ClipDrawable.HORIZONTAL);
        mProgressbar.setProgressDrawable(d);
    }

    if (indexOfChild(mProgressbar) == -1) {
        addView(mProgressbar);
    }
}
 
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:15,代码来源:MMWebView.java

示例11: setMaskOrientation

/**
 * 设置方向
 * @param orientation {@link MaskOrientation}
 */
public void setMaskOrientation(int orientation){
    switch (orientation){
        case MaskOrientation.LeftToRight:
            gravity = Gravity.LEFT;
            orientaion = ClipDrawable.HORIZONTAL;
            break;
        case MaskOrientation.RightToLeft:
            gravity = Gravity.RIGHT;
            orientaion = ClipDrawable.HORIZONTAL;
            break;
        case MaskOrientation.TopToBottom:
            gravity = Gravity.TOP;
            orientaion = ClipDrawable.VERTICAL;
            break;
        case MaskOrientation.BottomToTop:
        default:
            gravity = Gravity.BOTTOM;
            orientaion = ClipDrawable.VERTICAL;
            break;
    }
    if(maskDrawable == null){
        return;
    }
    clipDrawable = new ClipDrawable(maskDrawable, gravity, orientaion);
    initAnim();
}
 
开发者ID:chiemy,项目名称:LoadingImageView,代码行数:30,代码来源:LoadingImageView.java

示例12: applyProgressBarSettings

private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);

        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
 
开发者ID:ShkurtiA,项目名称:AndroidPullMenu,代码行数:10,代码来源:DefaultHeaderTransformer.java

示例13: tileify

private Drawable tileify(Drawable drawable, boolean clip) {
    if (drawable instanceof DrawableWrapper) {
        Drawable inner = ((DrawableWrapper) drawable).getWrappedDrawable();
        if (inner != null) {
            inner = tileify(inner, clip);
            ((DrawableWrapper) drawable).setWrappedDrawable(inner);
        }
    } else if (drawable instanceof LayerDrawable) {
        LayerDrawable background = (LayerDrawable) drawable;
        final int N = background.getNumberOfLayers();
        Drawable[] outDrawables = new Drawable[N];

        for (int i = 0; i < N; i++) {
            int id = background.getId(i);
            outDrawables[i] = tileify(background.getDrawable(i),
                    (id == android.R.id.progress || id == android.R.id.secondaryProgress));
        }
        LayerDrawable newBg = new LayerDrawable(outDrawables);

        for (int i = 0; i < N; i++) {
            newBg.setId(i, background.getId(i));
        }

        return newBg;

    } else if (drawable instanceof BitmapDrawable) {
        BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
        bitmapDrawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
        return (clip) ? new ClipDrawable(bitmapDrawable, Gravity.LEFT,
                ClipDrawable.HORIZONTAL) : bitmapDrawable;
    }

    return drawable;
}
 
开发者ID:ukiy2010,项目名称:BetterRatingBar,代码行数:34,代码来源:BetterRatingBar.java

示例14: createHeader

/**
 * Riga grigia cra spazio
 */
private void createHeader() {

    if (collected.getIconResourceId() != 0)
        FontAwesomeUtil.prepareAwesomeFontAweTextView(getActivity(), nodeic, SimpleTagViewUtils.getAwesomeNames(getActivity()).get(collected.getIconResourceId()));


    par.setMax(Constants.MAX_HEALTH);

    // ProgressBar sfumata
    final ShapeDrawable pgDrawable = new ShapeDrawable(new RoundRectShape(Constants.roundedCorners, null, null));
    final LinearGradient gradient = new LinearGradient(0, 0, 250, 0, getResources().getColor(color.aa_red),
            getResources().getColor(color.aa_green), android.graphics.Shader.TileMode.CLAMP);
    // pgDrawable.getPaint().setStrokeWidth(3);
    pgDrawable.getPaint().setDither(true);
    pgDrawable.getPaint().setShader(gradient);

    ClipDrawable progress = new ClipDrawable(pgDrawable, Gravity.START, ClipDrawable.HORIZONTAL);
    par.setBackgroundResource(android.R.drawable.progress_horizontal);
    par.setProgressDrawable(progress);
    par.setMax(50);
    par.setProgress(20);
    par.setProgress(0); // <-- BUG Android
    par.setMax(Constants.MAX_HEALTH);
    refreshHeader();

    Log.d(Constants.TAG,
            "Setting bar at " + collected.getHealth() + " win width=" + SoulissApp.getDisplayWidth() / 2);
}
 
开发者ID:souliss,项目名称:soulissapp,代码行数:31,代码来源:NodeDetailFragment.java

示例15: createDrawables

private Drawable[] createDrawables(Bitmap[] bitmaps) {
    Drawable[] pieces = new Drawable[bitmaps.length];
    for (int i = 0; i < bitmaps.length; i++) {
        BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), bitmaps[i]);
        bitmapDrawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
        if (i == 0) {
            pieces[i] = bitmapDrawable;
        } else {
            pieces[i] = new ClipDrawable(bitmapDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL);
        }
    }
    return pieces;
}
 
开发者ID:kazy1991,项目名称:FontDrawable,代码行数:13,代码来源:FontProgressDrawable.java


注:本文中的android.graphics.drawable.ClipDrawable.HORIZONTAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。