You should put the library in inside(like a module with the package name: uk.co.deanwild.materialshowcaseview) the Application Project. In order to specify a module dependency, simply:
- Right click on Application->Open Module Settings
- Click on the '+' icon
- Select the root directory for your library module you'd like to add.
- Follow the prompts
Then, this module will show up in your project. Then, you need to add it to Application as a library dependency. Once again, in your Module Settings:
- Select your Application module
- Select the Dependencies tab on the right
- Click the '+' icon on the bottom
- Select Module Dependency
- Select your desired library module
then, go to MaterialShowcaseView$Builder.java
and add this:
public Builder setTarget(Target target) {
showcaseView.setTarget(target);
return this;
}
finally... in the MainActivity or your fragment create a Target class
Target mTarget = new Target() {
@Override
public Rect getBounds() {
Point p = getPoint();
return new Rect(p.x - 190, p.y - 190, p.x + 190, p.y + 190);
}
@Override
public Point getPoint() {
// Get approximate position of actions items
int height = toolbar.getHeight();
int width = toolbar.getWidth();
int x = height / 2;
int y = height / 2;
width -= x;
return new Point(width, y);
}
};new MaterialShowcaseView.Builder(getActivity())
.setTarget(mTarget)
.setDismissText("GOT IT")
.setContentText("Text content")
.setDelay(275) // optional but starting animations immediately in onCreate can make them choppy
.singleUse("ID_OF_SHOWCASE")// provide a unique ID used to ensure it is only shown once
.show();