I'm trying to create a vertical textview with the following code
public class VerticalTextView extends TextView{
public VerticalTextView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public VerticalTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public VerticalTextView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
protected void onDraw(Canvas canvas) {
Log.i("VerticalTextView", "onDraw Called");
canvas.save();
canvas.rotate(-90, getWidth() / 2, getHeight() / 2);
super.onDraw(canvas);
canvas.restore();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO Auto-generated method stub
super.onMeasure(heightMeasureSpec, widthMeasureSpec);
super.setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());
}
}
however I'm finding that it is not redefining the full width in the new height. and therefore the texts is really truncated.
Any ideas? m