Skip to content

Example of using the Android rotation sensor and visualizing the device rotation with a custom view.

License

Notifications You must be signed in to change notification settings

baoshaoqiantest/android-rotation-sensor-sample

 
 

Repository files navigation

android-rotation-sensor-sample

This is a sample application that uses the Android rotation sensor and displays the device rotation (pitch/roll) with a custom view (an attitude indicator, aka "artificial horizon").

It shows proper usage of the following Android features:

  • Monitoring the rotation vector sensor (but only while the activity is visible).
  • Converting the raw rotation matrix to pitch and roll, measured in degrees.
  • Adjusting the rotation values based on the device orientation (e.g. portrait vs. landscape).
  • Drawing a custom view, including using Porter-Duff transfer mode to create an anti-aliased circle cut-out.

Screenshot

About

Example of using the Android rotation sensor and visualizing the device rotation with a custom view.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%