Back to project page android-drag-drop.
The source code is released under:
MIT License
If you think the Android project android-drag-drop listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.mydraggable; //from w w w .j av a2s .c om import android.R.integer; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.Paint.Style; import android.util.AttributeSet; import android.widget.TextView; public class MyTextView extends TextView { Paint mPaint; private void _init(){ // ?????? mPaint = new Paint(); // mPaint.setColor(0xFFDD0000); // ? mPaint.setColor(0xFF000000); // ? mPaint.setStrokeWidth(5); mPaint.setAntiAlias(true); mPaint.setStyle(Style.STROKE); } public MyTextView(Context context) { super(context); _init(); } public MyTextView(Context context, AttributeSet attrs) { super(context, attrs); _init(); } public MyTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); _init(); } @Override protected void onDraw(Canvas canvas) { // ????????? super.onDraw(canvas); // ????? int w = getWidth(); int h = getHeight(); canvas.drawRect(0, 0, w, h, mPaint); } public void setBorderColor(int color){ mPaint.setColor(color); this.invalidate(); } }