이 어떻게 API를 뒤로 23방법
public class CustomImageViewCircularShape extends ImageView {
public static float radius = 100.0f;
public CustomImageViewCircularShape(Context context) {
super(context);
}
public CustomImageViewCircularShape(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomImageViewCircularShape(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onDraw(Canvas canvas) {
Path clipPath = new Path();
RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight());
clipPath.addRoundRect(rect, radius, radius, Path.Direction.CW);
canvas.clipPath(clipPath);
super.onDraw(canvas);
}
}
하지만 API 16도 안드로이드 스튜디오는 경고를 제공하지 않습니다 작동하지 관련 circularImageView을 얻고있다 API를 <20 (안드로이드)에 원형 이미지보기를 얻을 수 있습니다 지원하다 ? 왜 그것이 작동하지 않거나 내가 오래된 Apis에서 작동하게 만들 수있는 아이디어?
어쩌면이 라이브러리는 내가 찾던 당신이 https://github.com/hdodenhof/CircleImageView – Harry
@harry 정확히 도움이 될 수 있습니다
당신 같은 접근 방식에 대한http://frescolib.org/docs/rounded-corners-and-circles.html
이 하나의 시도 –
감사를 추가하는 것을 잊어 버렸습니다 : D @harry –