I have an object thats subclassed from TextView.
I am trying to draw a blue line when a variable is true in the onDraw() method of my custom TextView.
My Code
if (this._selected) {
this.bluePaint.setColor(getResources().getColor(R.color.actionBlue));
float pix = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6, getResources().getDisplayMetrics());
this.bluePaint.setStrokeWidth(pix);
canvas.drawLine(0,this.getHeight()-(pix/2),this.getWidth(),this.getHeight()-(pix/2),this.bluePaint);
Log.d("CCTab","Tab Height:"+this.getHeight()+" Width:"+this.getWidth()+" StrokeWidth:"+pix);
}
Now this works in Eclair (2.1, API level 7) however it doesn’t work in Gingerbread (2.6 & 2.7, API level 9 & 10).
My Question
Why?
Thanks in advance
I never did find a solution to this problem. However as a workaround instead of using the TextView to extend my class from I used View and implemented the drawing of the text manually as well as drawing this line and that has worked.