RangeSeekBar.java 文件源码

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

项目:Rey-MusicPlayer 作者:
/**
 * Draws the widget on the given canvas.
 */
@Override
protected synchronized void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    // draw seek bar background line
    final RectF rect = new RectF(padding, 0.5f * (getHeight() - lineHeight), getWidth() - padding, 0.5f * (getHeight() + lineHeight));
    paint.setStyle(Style.FILL);
    paint.setColor(ContextCompat.getColor(getContext(), R.color.pink));
    paint.setAntiAlias(true);
    canvas.drawRect(rect, paint);

    // draw seek bar active range line
    rect.left = normalizedToScreen(normalizedMinValue);
    rect.right = normalizedToScreen(normalizedMaxValue);

    // orange color
    paint.setColor(Color.GRAY);
    canvas.drawRect(rect, paint);

    // draw minimum thumb
    drawThumb(normalizedToScreen(normalizedMinValue), Thumb.MIN.equals(pressedThumb), canvas);

    // draw maximum thumb
    drawThumb(normalizedToScreen(normalizedMaxValue), Thumb.MAX.equals(pressedThumb), canvas);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号