Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.content.Context;
- import android.graphics.Canvas;
- import android.graphics.Color;
- import android.graphics.Paint;
- import android.util.AttributeSet;
- import android.view.View;
- public class AimView extends View {
- private Paint mPaint;
- public AimView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init();
- }
- public AimView(Context context) {
- super(context);
- init();
- }
- private void init(){
- mPaint = new Paint();
- mPaint.setColor(Color.BLACK);
- mPaint.setStyle(Paint.Style.STROKE);
- mPaint.setStrokeWidth(10);
- }
- @Override
- protected void onDraw(Canvas canvas) {
- int w = getWidth();
- int h = getHeight();
- float left = w*3.f/10;
- float top = h*3.f/10;
- float right = w*7.f/10;
- float bottom = h*7.f/10;
- canvas.drawRect(left, top, right, bottom, mPaint); //todo smth like this
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement