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" ...

Get Cardboard VR Projects for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.