A library for adding a simple welcome activity to your Android app.
Specify resource identifiers to customize each welcome page:
Description | View | Resource Id (yours) |
---|---|---|
image | ImageView | R.drawable.your_image |
header | TextView | R.string.your_page_header |
content | TextView | R.string.your_page_content |
background color | Layout | R.color.your_page_color |
See the Aloha project page for more details.
For a working implementation see the sample application project: android-aloha-sample.
The sample application can also be installed from the Play Store.
-
The library is available on JCenter. Add the dependency to your build.gradle file:
dependencies { compile 'honuapps:aloha:0.9.0' }
-
Prepare your resources for each welcome page: image, header, content, and background color.
-
Create a WelcomeActivity that extends BaseWelcomeActivity.
-
In your WelcomeActivity, implement createPages():
@Override public void createPages() { addPage(new PageDescriptor(R.string.welcome_header_0, R.string.welcome_content_0, R.drawable.welcome_image_0, R.color.welcome_color_0)); addPage(new PageDescriptor(R.string.welcome_header_1, R.string.welcome_content_1, R.drawable.welcome_image_1, R.color.welcome_color_1)); addPage(new PageDescriptor(R.string.welcome_header_2, R.string.welcome_content_2, R.drawable.welcome_image_2, R.color.welcome_color_2)); }
-
Declare your WelcomeActivity in AndroidManifest.xml:
-
Modify your MainActivity to start the WelcomeActivity:
if (WelcomeHelper.isWelcomeRequired(this)) { startActivity(new Intent(MainActivity.this, WelcomeActivity.class)); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); }
The sample application uses images under CC0 license.
ISC license information LICENSE