11

I am using https://github.com/amlcurran/ShowcaseView library for Showcaseview
how to make rectangle view instead of circle ?
and how to using it for one of the listview item? thanks

1
Samad
  • 1,776
  • 2
  • 20
  • 35

2 Answers2

3

Refer to the CustomShowcaseActivity in the sample app. It creates a rectangular showcase. It defines a CustomShowcaseView with a constructor that sets the width and height of the showcase rectangle from resource file dimens.xml:

width = resources.getDimension(R.dimen.custom_showcase_width);
height = resources.getDimension(R.dimen.custom_showcase_height);

The CustomShowcaseActivity is associated to the ShowcaseView in the Builder. This is also where the showcase target is set.

The CustomShowcaseView implements ShowcaseDrawer so you use setShowcaseDrawer(). It's not a drawer, but rather a "draw - er".

The following shows this and targets a listview as you wanted:

ViewTarget target = new ViewTarget(R.id.listView, this);

sv = new ShowcaseView.Builder(this)
            .setTarget(target)
            .setShowcaseDrawer(new CustomShowcaseActivity.CustomShowcaseView(getResources()))
            .build();
TT--
  • 2,956
  • 1
  • 27
  • 46
2

Take a look at this: MaterialShowCaseView that is a improved version of original ShowCaseView library. It has more featurs like sequence and .withRectangleShape() in it. An example of rectangle showcase is:

    // single example
new MaterialShowcaseView.Builder(this)
    .setTarget(mButtonShow)
    .setDismissText("GOT IT")
    .withRectangleShape() // this makes it rectangle
    .setContentText("This is some amazing feature you should know about")
    .setDelay(withDelay) // optional but starting animations immediately in onCreate can make them choppy
    .singleUse(SHOWCASE_ID) // provide a unique ID used to ensure it is only shown once
    .show();

for use it for one of items, use a if in onBindViewHolder with specific position and show it simply.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Mahdi Moqadasi
  • 2,029
  • 4
  • 26
  • 52