RotateIndicatorView.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:RoateIndicatorViewDemo 作者:
public RotateIndicatorView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TypedArray array = context.getTheme().obtainStyledAttributes(attrs, R.styleable.RotateIndicatorView, defStyleAttr, 0);
    diameter = array.getDimensionPixelSize(R.styleable.RotateIndicatorView_diameter, 50);
    textColor = array.getColor(R.styleable.RotateIndicatorView_textColor, Color.RED);
    textBackgroundColor = array.getColor(R.styleable.RotateIndicatorView_textBackgroundColor, Color.WHITE);
    maxPage = array.getInt(R.styleable.RotateIndicatorView_maxPage, 1);

    rightBitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.indicator2);
    Matrix matrix = new Matrix();
    float scale = 1.0f * diameter / rightBitmap.getHeight();
    matrix.postScale(scale, scale);
    rightBitmap = Bitmap.createBitmap(rightBitmap, 0, 0, rightBitmap.getWidth(), rightBitmap.getHeight(), matrix, true);

    mPaint = new Paint();
    camera = new Camera();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号