当前位置: 首页>>代码示例>>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;未经允许,请勿转载。