Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4019576
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:07:18+00:00 2026-05-20T10:07:18+00:00

I have a drawing activity that creates a custom ‘canvas’ View that occupies the

  • 0

I have a drawing activity that creates a custom ‘canvas’ View that occupies the entire screen, allowing the user to draw on it. I have a requirement to lock the Activity to the portrait orientation, as the drawing app is a sketchpad replacement, and the user would have the need to rotate the ‘pad’ to draw without the pad flipping around on them. This of course means that the Options Menu is locked to that orientation as well and depending on the user, the menu could be popping out of the top, bottom or sides. I’d like to have the Options Menu always be located at the bottom relative to the user… some options I am considering and would appreciate any suggestions or info:

  1. Allow orientation changes, so the menu moves as needed, then use the SensorManager to listen for the orientation, and manually rotate the canvas View back to the ‘correct’ orientation (portrait). This would be ugly, as there could be a delay in the rotation of the canvas, and it introduces some potentially complex calculations, etc due to the X/Y being swapped.
  2. Restrict orientation changes, then use the SensorManager to listen for the orientation, and manually rotate the Options Menu back to the bottom. No idea if this is possible.
  3. Lock orientation, and create a custom View that intercepts the menu button and displays a ‘fake’ Options Menu that I need to manage, etc. Really really don’t want to have to replace built-in OS functionality, could be a nightmare to maitain for different versions of OS in future, etc.

Anyone have any ideas on how to handle this? I’d love if #2 was possible, but can’t find anything related to that.

Thanks,

Paul

EDIT:

Have confirmed that #2 is not possible, so I guess my options are #1, #3, unless anyone else has any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:07:18+00:00Added an answer on May 20, 2026 at 10:07 am

    My solution is as follows:

    • Allow normal orientation changes in the Android Manifest for the Activity.
    • In the custom ‘canvas’ view constructor, fire up a tracking field, mDisplay, that gets the display information via:

    Code:

    mDisplay = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    
    • In onDraw(), check to see if the display rotation is something other than 0, and rotate the canvas back to the 0 rotation value:

    Code:

    if (mDisplay.getRotation() > 0) {
        canvas.save(Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);
        canvas.rotate(-mDisplay.getRotation(), px, py);
        ...
        do stuff
        ...
        canvas.restore();
    }
    

    Not sure that it’s the best solution, but it seems to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view that I want to add some custom drawing to. I
I'm doing custom drawing in datagridview cells and I have items that can vertically
I have a problem drawing something quickly in .NET. I don't think that any
I have started developing a drawing application in as3. I am thinking that I
I have a simulation that uses OpenGL for drawing. While it is running, I
I have subclassed View and do some bitmap drawing inside of the onDraw method.
I have a UIView subclass that I'm drawing a PDF onto (using a CATiledLayer).
I have developed application for drawing some shapes (lines mostly) , now i need
I have an object of the type System.Drawing.Image and want to make every pixel
I have an application that receives information from a database, and is used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.