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


Java GradientDrawable.setGradientType方法代码示例

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


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

示例1: OverlappedWidget

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
public OverlappedWidget(Context context, String bookId,
                        List<BookMixAToc.mixToc.Chapters> chaptersList,
                        OnReadStateChangeListener listener) {
    super(context, bookId, chaptersList, listener);

    mTouch.x = 0.01f;
    mTouch.y = 0.01f;

    mPath0 = new Path();

    int[] mBackShadowColors = new int[]{0xaa666666, 0x666666};
    mBackShadowDrawableRL = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, mBackShadowColors);
    mBackShadowDrawableRL.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mBackShadowDrawableLR = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, mBackShadowColors);
    mBackShadowDrawableLR.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:OverlappedWidget.java

示例2: CoverPageAnim

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
public CoverPageAnim(int w, int h, View view, OnPageChangeListener listener) {
    super(w, h, view, listener);
    mSrcRect = new Rect(0, 0, mViewWidth, mViewHeight);
    mDestRect = new Rect(0, 0, mViewWidth, mViewHeight);
    int[] mBackShadowColors = new int[] { 0x66000000,0x00000000};
    mBackShadowDrawableLR = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT, mBackShadowColors);
    mBackShadowDrawableLR.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:10,代码来源:CoverPageAnim.java

示例3: init

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private void init(Context context){
    defaultWidth = 600;
    defaultHeight = 1000;
    pageNum = 1;
    scrollPageLeft = 0;
    scrollTime = 300;
    touchStyle = TOUCH_RIGHT;
    pageState = PAGE_STAY;

    touchPoint = new MyPoint(-1,-1);
    mScroller = new Scroller(context,new LinearInterpolator());

    int[] mBackShadowColors = new int[] { 0x66000000,0x00000000};
    shadowDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, mBackShadowColors);
    shadowDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
 
开发者ID:AnliaLee,项目名称:BookPage,代码行数:17,代码来源:CoverPageView.java

示例4: bindImageAndForeground

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.M)
private void bindImageAndForeground(View image, Bitmap bitmap) {
    if (bitmap == null) {
        bitmap = BitmapUtils.bitmapResizeFromResource(context.getResources(), R.drawable.default_song, imageWidth, imageHeight);
    }

    int defaultTC = Color.WHITE;
    int defaultBC = Color.GRAY;
    int[] colors = new int[4];
    ColorUtils.get4LightColorWithTextFormBitmap(bitmap, defaultBC, defaultTC, colors);

    int color = colors[0];
    color = color == defaultBC ? colors[2] : color;
    color = android.support.v4.graphics.ColorUtils.setAlphaComponent(color, 255);
    GradientDrawable dra = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT,
            new int[]{color, Color.TRANSPARENT});
    dra.setGradientType(GradientDrawable.LINEAR_GRADIENT);
    image.setBackground(dra);
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:21,代码来源:RMPAdapter.java

示例5: initBorder

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private void initBorder() {
//        if (mWipeOffBorder || mIdentity == null || !mIdentity.officialMember) {
//            mDrawable = null;
//            setBackground(null);
//            return;
//        }

        if (mDrawable == null) {
            float radius = 4f;

            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
            gradientDrawable.setShape(GradientDrawable.RECTANGLE);
            gradientDrawable.setDither(true);
            gradientDrawable.setStroke(STROKE_SIZE, mColor);
            gradientDrawable.setCornerRadius(radius);

            mDrawable = gradientDrawable;
        } else {
            mDrawable.setStroke(STROKE_SIZE, mColor);
        }

        setBackground(mDrawable);
    }
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:25,代码来源:IdentityView.java

示例6: createCircleGradientDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
/**
 * 创建一张渐变图片,支持韵脚。
 *
 * @param startColor 渐变开始色
 * @param endColor   渐变结束色
 * @param radius     圆角大小
 * @param centerX    渐变中心点 X 轴坐标
 * @param centerY    渐变中心点 Y 轴坐标
 * @return 返回所创建的渐变图片。
 */
@TargetApi(16)
public static GradientDrawable createCircleGradientDrawable(@ColorInt int startColor,
                                                            @ColorInt int endColor, int radius,
                                                            @FloatRange(from = 0f, to = 1f) float centerX,
                                                            @FloatRange(from = 0f, to = 1f) float centerY) {
    GradientDrawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setColors(new int[]{
            startColor,
            endColor
    });
    gradientDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
    gradientDrawable.setGradientRadius(radius);
    gradientDrawable.setGradientCenter(centerX, centerY);
    return gradientDrawable;
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:26,代码来源:QMUIDrawableHelper.java

示例7: initBackground

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private void initBackground() {
    GradientDrawable.Orientation orientation = getOrientation();

    GradientDrawable drawable = new GradientDrawable(orientation, new int[]{bgGradientStart, bgGradientCenter, bgGradientEnd});
    drawable.setShape(GradientDrawable.RECTANGLE);
    drawable.setCornerRadius(dialogRadius);

    switch (bgGradientType) {
        case GRADIENT_RADIAL:
            drawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
            break;
        case GRADIENT_SWEEP:
            drawable.setGradientType(GradientDrawable.SWEEP_GRADIENT);
            break;
        default:
            drawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
            break;
    }

    if (isHalloween) {
        drawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
        drawable.setGradientRadius(getContext().getResources().getDimensionPixelSize(R.dimen.dialog_height) / 2);
    } else {
        drawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        root.setBackground(drawable);
    } else {
        root.setBackgroundDrawable(drawable);
    }
}
 
开发者ID:appwise-labs,项目名称:NoInternetDialog,代码行数:33,代码来源:NoInternetDialog.java

示例8: createDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
/**
 * 创建阴影的GradientDrawable
 */
private void createDrawable() {
    int[] color = {0x333333, 0xb0333333};
    mFolderShadowDrawableRL = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, color);
    mFolderShadowDrawableRL.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFolderShadowDrawableLR = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, color);
    mFolderShadowDrawableLR.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mBackShadowColors = new int[]{0xff111111, 0x111111};
    mBackShadowDrawableRL = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, mBackShadowColors);
    mBackShadowDrawableRL.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mBackShadowDrawableLR = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, mBackShadowColors);
    mBackShadowDrawableLR.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontShadowColors = new int[]{0x80111111, 0x111111};
    mFrontShadowDrawableVLR = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, mFrontShadowColors);
    mFrontShadowDrawableVLR.setGradientType(GradientDrawable.LINEAR_GRADIENT);
    mFrontShadowDrawableVRL = new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, mFrontShadowColors);
    mFrontShadowDrawableVRL.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontShadowDrawableHTB = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, mFrontShadowColors);
    mFrontShadowDrawableHTB.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontShadowDrawableHBT = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, mFrontShadowColors);
    mFrontShadowDrawableHBT.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:PageWidget.java

示例9: create

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
public static GradientDrawable create(@ColorInt int startColor, @ColorInt int endColor, int radius,
                                      @FloatRange(from = 0f, to = 1f) float centerX,
                                      @FloatRange(from = 0f, to = 1f) float centerY) {
    GradientDrawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setColors(new int[]{
            startColor,
            endColor
    });
    gradientDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
    gradientDrawable.setGradientRadius(radius);
    gradientDrawable.setGradientCenter(centerX, centerY);
    return gradientDrawable;
}
 
开发者ID:xxczaki,项目名称:music-player,代码行数:14,代码来源:GradientUtils.java

示例10: onViewCreated

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
@Override
protected void onViewCreated() {
	//蓝色线性渐变色背景
	GradientDrawable drawable = new GradientDrawable(
			GradientDrawable.Orientation.TOP_BOTTOM, new int[]{0xFF5b7ef0, 0xFF6687f2});
	drawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
	titleBar.setBackgroundDrawable(drawable);
	//蓝色纯色背景
	// titleBar.setBackgroundColor(getContext().getResources().getColor(ResHelper.getColorRes(getContext(), "bbs_theme0_blue")));
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:11,代码来源:Theme0MainView.java

示例11: drawBackground

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private void drawBackground(View v, int color, boolean isCircle) {
	if (isCircle) {
        GradientDrawable gd = new GradientDrawable();
        gd.setGradientType(GradientDrawable.RADIAL_GRADIENT);
        gd.setColors(new int[]{color, Color.TRANSPARENT });
        gd.setGradientRadius((Defaults.IMAGE_HEIGHT - Defaults.CIRCLE_PADDING)/2);
        v.setBackground(gd);
        
    } else {
        ShapeDrawable oval = new ShapeDrawable (new OvalShape());
        oval.getPaint().setColor(color);
        v.setBackground(oval);
    }
}
 
开发者ID:prashantsaini1,项目名称:titanium-android-imagepicker,代码行数:15,代码来源:ImagePickerActivity.java

示例12: createDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
/**
 * 创建阴影的GradientDrawable
 */
private void createDrawable() {
    int[] color = { 0x333333, 0xb0333333 };
    mFolderShadowDrawableRL = new GradientDrawable(
            GradientDrawable.Orientation.RIGHT_LEFT, color);
    mFolderShadowDrawableRL
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFolderShadowDrawableLR = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT, color);
    mFolderShadowDrawableLR
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mBackShadowColors = new int[] { 0xff111111, 0x111111 };
    mBackShadowDrawableRL = new GradientDrawable(
            GradientDrawable.Orientation.RIGHT_LEFT, mBackShadowColors);
    mBackShadowDrawableRL.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mBackShadowDrawableLR = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT, mBackShadowColors);
    mBackShadowDrawableLR.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontShadowColors = new int[] { 0x80111111, 0x111111 };
    mFrontShadowDrawableVLR = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT, mFrontShadowColors);
    mFrontShadowDrawableVLR
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);
    mFrontShadowDrawableVRL = new GradientDrawable(
            GradientDrawable.Orientation.RIGHT_LEFT, mFrontShadowColors);
    mFrontShadowDrawableVRL
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontShadowDrawableHTB = new GradientDrawable(
            GradientDrawable.Orientation.TOP_BOTTOM, mFrontShadowColors);
    mFrontShadowDrawableHTB
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontShadowDrawableHBT = new GradientDrawable(
            GradientDrawable.Orientation.BOTTOM_TOP, mFrontShadowColors);
    mFrontShadowDrawableHBT
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:45,代码来源:SimulationPageAnim.java

示例13: createDrawable

import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private void createDrawable() {
    int[] color = { 0x333333, 0xB0333333 };
    mFolderDrawableRL = new GradientDrawable(
            GradientDrawable.Orientation.RIGHT_LEFT, color);
    mFolderDrawableRL
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFolderDrawableLR = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT, color);
    mFolderDrawableLR
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mBackShadowColors = new int[] { 0xFF111111, 0x111111 };
    mBackDrawableRL = new GradientDrawable(
            GradientDrawable.Orientation.RIGHT_LEFT, mBackShadowColors);
    mBackDrawableRL.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mBackDrawableLR = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT, mBackShadowColors);
    mBackDrawableLR.setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontShadowColors = new int[] { 0x80111111, 0x111111 };
    mFrontDrawable_v_lr = new GradientDrawable(
            GradientDrawable.Orientation.LEFT_RIGHT, mFrontShadowColors);
    mFrontDrawable_v_lr
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);
    mFrontDrawable_v_rl = new GradientDrawable(
            GradientDrawable.Orientation.RIGHT_LEFT, mFrontShadowColors);
    mFrontDrawable_v_rl
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontDrawable_h_tb = new GradientDrawable(
            GradientDrawable.Orientation.TOP_BOTTOM, mFrontShadowColors);
    mFrontDrawable_h_tb
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);

    mFrontDrawble_h_bt = new GradientDrawable(
            GradientDrawable.Orientation.BOTTOM_TOP, mFrontShadowColors);
    mFrontDrawble_h_bt
            .setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
 
开发者ID:1014277960,项目名称:DailyReader,代码行数:42,代码来源:ReadView.java


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