user1455450
user1455450

Reputation: 25

Showcaseview on girdview item android

I have created an app and want to show some first time user bubbles. I am using showcaseview https://github.com/amlcurran/ShowcaseView

How do i set it on the first element of the gridview ?

Upvotes: 0

Views: 549

Answers (1)

Pranjal Sahu
Pranjal Sahu

Reputation: 1469

You can use ViewTarget as follows:

Your activity should implement OnShowcaseEventListener.

new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
            View targetView = gridview.getChildAt(0);
            ViewTarget target = new ViewTarget(targetView);
            ShowcaseView sv  = new ShowcaseView.Builder(this, true)
                .setTarget(target)
                .setContentTitle("YOUR MESSAGE")
                .setStyle(R.style.CustomShowcaseTheme2)
                .setShowcaseEventListener(this)
                .build();
            }
        }, 5000);

Basically you are passing the required view to the ViewTarget. You can highlight other child also. Just remember to execute the code only after the views ahve been inflated otherwise it might throw exception. See if it works for you.

Upvotes: 2

Related Questions