androidtextview

Can't drawLine in TextView's onDraw


I can't draw anything in my custom TextView class.

Sorry thats not strictly true, it works in Eclair but not in honeycomb!!!

The onDraw() method is definitely being called but nothing is getting drawn (in honeycomb).

Here is my onDraw method.

super.onDraw(canvas):
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,0,this.getWidth(),20,this.bluePaint);

Is onDraw handled differently in Eclair to Honeycomb? Am I missing something?

Thanks in advance


Solution

  • I didn't manage to solve this problem.

    What I did in the end was create my own custom text view using an object that extends View and manually drawing the text on there.

    I'm not sure why TextView doesn't allow line drawing but hey, just another solution to a never ending stream of problems.