Gesture Navigation Tutorial for Android

In this Android tutorial, you will learn how to add support for gesture navigation to your app, a feature that was added in Android 10. By Denis Buketa.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 3 of 3 of this article. Click here to view the first page.

Handling Landscape Orientation

When making your app edge-to-edge, remember to check how your app behaves in landscape orientation.

Enable 3-button navigation and remove android:screenOrientation="portrait" for your activities in AndroidManifest.xml. Run the app in the landscape orientation. You’ll get something like this, which obviously isn’t great:

Landscape view of Notes screen with yellow My First Note box and 3 button navigation incorrectly displayed on left edge.

This tutorial doesn’t cover how to handle landscape orientation. You can experiment with landscape yourself by applying the techniques we used for portrait. You’ll have to play some more with the padding in the landscape orientation, but it’s an excellent challenge to practice what you’ve learned. :]

Testing 3-Button Navigation and Gestural Navigation

Well done! You’ve adapted your app to be nav-ready. Finally, test your app in both navigation modes.

Use the device settings like you did in the previous steps to try each navigation mode and observe how the app behaves in each. When finished, your app will behave like this:

Gif of user using gestural navigation to choose a note color, navigate to note screen and back to settings.

Where to Go From Here?

Wow, that was a lot of work!

You can download the completed project files by clicking on the Download Materials button at the top or bottom of the tutorial.

If you want to check out some more materials on this topic, please check this talk from the Google I/O’19 and Official Android documentation.

I hope you enjoyed this tutorial. If you have any questions or comments, please join the forum discussion below!