ShowcaseView is a very useful tool.It can be used to provide hints and information to our app users regarding controls and features.
Today we are going to implement ShowcaseView using a free library called “amlcurran/ShowcaseView”. It is very useful and had many features and styles.
amlcurran/ShowcaseView is a simple and easy to implement showcaseview tool and this library is distributed under an Apache 2.0 License.
Step 1
First,navigate to your build.gradle (Module:app) and add the library.
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
There are multiple types of implementation like
1.Action Items
2.Fragments
3.Events
4.Single shot
5.Animations
6.Custom text
7.Custom showcase.
We are going to demonstrate single shot – It can be used to provide hints only a single time in the lifetime of the app. So it won’t annoy user every time they open your app.
It only displays on the first launch of the application.
Step 2
Target viewTarget = new ViewTarget(R.id.imgContainer, this); // Add the control you need to focus by the ShowcaseView new ShowcaseView.Builder(this) .setTarget(viewTarget) .setContentTitle(R.string.title_single_shot) // Add your string file (title_single_shot) in values/strings.xml .setContentText(R.string.R_string_desc_single_shot) // Add your string file (R_strings_desc_single_shot) in values/strings.xml .singleShot(42) .build();
Set the control you need to focus by Showcaseview.
NOTE
If you don’t need to focus on any control and just need to show a single message use this code instead.
new ShowcaseView.Builder(this) .setContentTitle(R.string.title_single_shot) // Add your string file (title_single_shot) in values/strings.xml .setContentText(R.string.R_string_desc_single_shot) // Add your string file (R_strings_desc_single_shot) in values/strings.xml .singleShot(42) .build();
For more reference and features please visit the Github page https://github.com/amlcurran/ShowcaseView
Sample application is available at https://play.google.com/store/apps/details?id=com.espian.showcaseview.sample