Coordinate conversion question

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 13

Apr 5, 2016, 11:37:14 PM via Website

How do I convert the absolute screen coordinates returned by the MotionEvent in onTouchEvent, to usable coordinates defined by 0,0 being upperleft corner of the usable part of the app, not upperleft corner of the screen? By "usable part of the app", I mean the large white area starting just below the gray title bar of the app. The upperleft corner of the screen has absolute coordinates of 0,0. The upperleft corner of the app's title bar has coordinates of contentView.getLeft(),contentView.getTop() where contentView is declared as View contentView = findViewById(Window.ID_ANDROID_CONTENT);. But I need to find the app's main usable working area, which starts just below the title bar. If anybody knows how to do this, PLEASE let me know.

By the way, what separates the title bar from the actual top of the screen is the Android status bar, which always is displayed.

Recommended by NextPit