當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。