O'Reilly logo

Cardboard VR Projects for Android by Matt Schoen, Jonathan Linowes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Hello Virtual World text overlay

For starters, we're just going to put some text on the screen that you might use for a toast message to the user, or a heads-up display (HUD) with informative content. We're going to implement this incrementally in small steps:

  1. Create a simple overlay view with some text.
  2. Center it on the screen.
  3. Add parallax for stereoscopic viewing.

A simple text overlay

First, we'll add some overlay text in a simple way, not stereoscopically, just text on the screen. This will be our initial implementation of the OverlayView class.

Open the activity_main.xml file, and add the following lines to add an OverlayView to your layout:

<.OverlayView android:id="@+id/overlay" android:layout_width="fill_parent" android:layout_height="fill_parent" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required