android editText 自定义边框

我个人不费话,内容如题,以下是代码:
package com.puppet.custom.component;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.widget.EditText;

public class SearchEditText extends EditText{
private Paint paint;
public SearchEditText(Context context) {
super(context);
//定义画笔
paint = getPaint();
//定义笔画粗细样式
paint.setStyle(Paint.Style.STROKE);
//定义笔画颜色
paint.setColor(Color.GRAY);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int w = getWidth();
int h = getHeight();
//下边框
canvas.drawLine(0, h, w, h, paint);
//右边框
canvas.drawLine(w, 0, w, h, paint);
//左边框
canvas.drawLine(0, 0, 0, h, paint);
//上边框
canvas.drawLine(0, 0, w, 0, paint);
}
}


以下是该控件的引用
package com.puppet.activity;

import com.puppet.custom.component.SearchEditText;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.widget.EditText;
import android.widget.LinearLayout;

public class TestLayout extends LinearLayout{

public TestLayout(Context context) {
super(context);
//设背景色为白色
setBackgroundColor(Color.WHITE);
setOrientation(LinearLayout.VERTICAL);

testBox = new SearchEditText(context);
//设置背景为"@null"
testBox.setBackgroundColor(0);
//设置显示(宽、高)
LayoutParams sbLp = new LayoutParams(300,LayoutParams.WRAP_CONTENT);
//设置边界,以便查看上边框样式
sbLp.topMargin = 5;
//居中显示
sbLp.gravity = Gravity.CENTER;
//设置该样式
testBox.setLayoutParams(sbLp);
testBox.setHint( "请从这里输入...");
//添加到布局
addView(testBox);

}
private EditText testBox = null;
}

下面是Activity的引用:
package com.puppet.activity;

import android.app.Activity;
import android.os.Bundle;

public class TestActivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

TestLayout test = new TestLayout(TestActivity. this);
setContentView(test);
}
}