package com.creamsugardonut.floatingapp;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.LinearLayout;
public class LinearLayoutOutlined extends LinearLayout {
public LinearLayoutOutlined(Context context) {
super(context);
setWillNotDraw(false);
}
public LinearLayoutOutlined(Context context, AttributeSet attrs) {
super(context, attrs);
setWillNotDraw(false);
}
@Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(255, 255, 255, 255);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(10);
Rect r = canvas.getClipBounds();
Rect outline = new Rect(1, 1, r.right - 1, r.bottom - 1);
canvas.drawRect(outline, strokePaint);
}
}
관련