Skip to content

Instantly share code, notes, and snippets.

Last active April 26, 2016 07:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Rotated textview for Xamarin Android
using Android.Content;
using Android.Widget;
using Android.Util;
using Android.Graphics;
namespace Droid
public class RotatedTextView : TextView
public RotatedTextView(Context ctx, IAttributeSet attr)
: base(ctx, attr)
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
base.OnMeasure(heightMeasureSpec, widthMeasureSpec);
SetMeasuredDimension(MeasuredHeight, MeasuredWidth);
protected override bool SetFrame(int left, int top, int right, int bottom)
return base.SetFrame(left, top, left + (bottom - top), top + (right - left));
protected override void OnDraw(Canvas canvas)
canvas.Translate(0, Width);
canvas.ClipRect(0, 0, Width, Height, Region.Op.Replace);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment