forked from ruboto/ruboto
-
Notifications
You must be signed in to change notification settings - Fork 0
Tutorial: adding a startup splash
Uwe Kubosch edited this page Oct 3, 2013
·
12 revisions
Display a splash screen on startup.
You should have completed the Setting Up a Ruboto Development Environment tutorial.
This tutorial has been tested with the following setups
| Platform | JDK | Ruby | Ruboto | Ruboto Core | Device | API level | Tester |
|---|---|---|---|---|---|---|---|
| OS X 10.8.5 | 1.7.0_40 | 2.0.0 | 0.15.0 | 0.6.0 | Emulator | 10 | donV |
| OS X 10.8.3 | 1.7.0_21 | 2.0.0 | 0.13.0 | 0.6.0 | Emulator | 10 | donV |
| ArchLinux x86_64 | openjdk 7.u13_2.3.7-2 | 1.9.3 | 0.10.1 | 0.5.2 | Sony Xperia SL | 16 | Nyangawa |
ruboto gen app --package org.ruboto.example.splash
cd splash
ruboto emulator
rake install start
You should see the standard "What hath Matz wrought?" screen.

To display a splash screen, you will have to prepare a suitable image for it. Here I use Ruboto logo for example.
When you have got your favourite image. Place it in your project as res/drawable/logo.png.
Ruboto has a built in XML-based splash function. So you can directly use it by adding res/layout/splash.xml.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_horizontal|center_vertical"
android:background="#30587c"
>
<!--Specify your splash image here-->
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/logo"
android:scaleType="fitCenter"
android:layout_weight="1"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please wait..."
android:color="#000000"
/>
</LinearLayout>
Redeploy the application with new scripts
rake install start
You should now be able to meet a splash screen before you see our standard "What hath Matz wrought?" screen.
Enjoy!