download: http://www.mediafire.com/?24h2ec47j9l4nye
package com.example.customimageview;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.ImageView;
public class ImageViewWithBorder extends ImageView {
private static Paint paint;
public ImageViewWithBorder(Context context, AttributeSet attrs) {
super(context, attrs);
paint = new Paint();
paint.setStrokeWidth(10);
paint.setColor(Color.GRAY);
paint.setStyle(Paint.Style.STROKE);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int height = this.getMeasuredHeight();
int width = this.getMeasuredWidth();
// Draw a border
canvas.drawRect(0, 0, width, height, paint);
// RectF mRectF = new RectF(0f, 0f, width, height);
// canvas.drawRoundRect(mRectF, 20, 20, paint);
// canvas.dr
// canvas.drawR
}
}
package com.example.customimageview;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.ImageView;
public class ImageViewWithBorder extends ImageView {
private static Paint paint;
public ImageViewWithBorder(Context context, AttributeSet attrs) {
super(context, attrs);
paint = new Paint();
paint.setStrokeWidth(10);
paint.setColor(Color.GRAY);
paint.setStyle(Paint.Style.STROKE);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int height = this.getMeasuredHeight();
int width = this.getMeasuredWidth();
// Draw a border
canvas.drawRect(0, 0, width, height, paint);
// RectF mRectF = new RectF(0f, 0f, width, height);
// canvas.drawRoundRect(mRectF, 20, 20, paint);
// canvas.dr
// canvas.drawR
}
}
No comments:
Post a Comment