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


Java OvalShape.resize方法代碼示例

本文整理匯總了Java中android.graphics.drawable.shapes.OvalShape.resize方法的典型用法代碼示例。如果您正苦於以下問題:Java OvalShape.resize方法的具體用法?Java OvalShape.resize怎麽用?Java OvalShape.resize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.drawable.shapes.OvalShape的用法示例。


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

示例1: getLargeNotificationIcon

import android.graphics.drawable.shapes.OvalShape; //導入方法依賴的package包/類
private Bitmap getLargeNotificationIcon(Bitmap bitmap) {
    Resources resources = mContext.getResources();
    int height = (int) resources.getDimension(android.R.dimen.notification_large_icon_height);
    int width = (int) resources.getDimension(android.R.dimen.notification_large_icon_width);
    final OvalShape circle = new OvalShape();
    circle.resize(width, height);
    final Paint paint = new Paint();
    paint.setColor(ApiCompatibilityUtils.getColor(resources, R.color.google_blue_grey_500));

    final Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(result);
    circle.draw(canvas, paint);
    float leftOffset = (width - bitmap.getWidth()) / 2f;
    float topOffset = (height - bitmap.getHeight()) / 2f;
    if (leftOffset >= 0 && topOffset >= 0) {
        canvas.drawBitmap(bitmap, leftOffset, topOffset, null);
    } else {
        // Scale down the icon into the notification icon dimensions
        canvas.drawBitmap(bitmap,
                new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()),
                new Rect(0, 0, width, height),
                null);
    }
    return result;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:26,代碼來源:DownloadNotificationService.java

示例2: addBall

import android.graphics.drawable.shapes.OvalShape; //導入方法依賴的package包/類
private ShapeHolder addBall(float x, float y) {
    OvalShape circle = new OvalShape();
    circle.resize(50f, 50f);
    ShapeDrawable drawable = new ShapeDrawable(circle);
    ShapeHolder shapeHolder = new ShapeHolder(drawable);
    shapeHolder.setX(x - 25f);
    shapeHolder.setY(y - 25f);
    int red = (int)(Math.random() * 255);
    int green = (int)(Math.random() * 255);
    int blue = (int)(Math.random() * 255);
    int color = 0xff000000 | red << 16 | green << 8 | blue;
    Paint paint = drawable.getPaint(); //new Paint(Paint.ANTI_ALIAS_FLAG);
    int darkColor = 0xff000000 | red/4 << 16 | green/4 << 8 | blue/4;
    RadialGradient gradient = new RadialGradient(37.5f, 12.5f,
            50f, color, darkColor, Shader.TileMode.CLAMP);
    paint.setShader(gradient);
    shapeHolder.setPaint(paint);
    balls.add(shapeHolder);
    return shapeHolder;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:21,代碼來源:BouncingBalls.java

示例3: createCircle

import android.graphics.drawable.shapes.OvalShape; //導入方法依賴的package包/類
private BGCircle createCircle(float x, float y) {
    OvalShape circle = new OvalShape();
    circle.resize(0, 0);
    ShapeDrawable drawable = new ShapeDrawable(circle);
    BGCircle circle1 = new BGCircle(drawable);
    circle1.setX(x);
    circle1.setY(y);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        circle1.setRadius(circleRadius);
    }
    drawable.getPaint().setColor(mTManager.colorBGCircle());
    return circle1;
}
 
開發者ID:paradoxie,項目名稱:SignCalender,代碼行數:14,代碼來源:MonthView.java

示例4: createBall

import android.graphics.drawable.shapes.OvalShape; //導入方法依賴的package包/類
private BallShape createBall(float x,float y) {
	// TODO Auto-generated method stub
OvalShape circle=new OvalShape();
circle.resize(BALL_SIZE, BALL_SIZE);
ShapeDrawable drawable=new ShapeDrawable(circle);
BallShape ball=new BallShape(drawable);
ball.setX(x-BALL_SIZE/2);
ball.setY(y-BALL_SIZE/2);
Paint paint=drawable.getPaint();
paint.setColor(0xff38B7ED);
return ball;
}
 
開發者ID:CrazyRunning,項目名稱:MyStudyHelper,代碼行數:13,代碼來源:BallView.java

示例5: addBall

import android.graphics.drawable.shapes.OvalShape; //導入方法依賴的package包/類
private BallsLoadingShapeHolder addBall(float x, float y) {
    OvalShape circle = new OvalShape();
    circle.resize(mBallRadius, mBallRadius);
    ShapeDrawable drawable = new ShapeDrawable(circle);
    BallsLoadingShapeHolder shapeHolder = new BallsLoadingShapeHolder(drawable);
    shapeHolder.setX(x);
    shapeHolder.setY(y);
    Paint paint = drawable.getPaint();
    paint.setColor(Color.RED);
    shapeHolder.setPaint(paint);
    shapeHolder.setAlpha(0f);
    return shapeHolder;
}
 
開發者ID:kylingo,項目名稱:MeUI,代碼行數:14,代碼來源:MeLoadingView.java


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