In my app I am displaying a webpage that is too big to fit on a portrait display, so I want to rotate it. I tried using RequestedOrientation = ScreenOrientation.Landscape;
on the activity but it changes the rotation for the entire phone, rather than just the webview. I also tried making a custom webview class:
public class VerticalWebView : WebView
{
bool topDown = true;
public VerticalWebView(Context context, IAttributeSet attrs) : base(context, attrs)
{
}
public override void Draw(Canvas canvas)
{
if (topDown)
{
canvas.Translate(Height, 0);
canvas.Rotate(90);
}
else
{
canvas.Translate(0, Width);
canvas.Rotate(-90);
}
canvas.ClipRect(0, 0, Width, Height, Region.Op.Replace);
base.Draw(canvas);
}
}
but i cannot get it to work with the webview XML in the layout file. Any input would be greatly appreciated