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:
Create a simple overlay view with some text.
Center it on the screen.
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" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" />
Note that we reference the OverlayView
class with just .OverlayView
. You may do this if your view class is in the same package as your MainActivity...