Abdalrhman Elsayed Abdalrhman Elsayed - 24 days ago 19
Android Question

what is the first Parameter of TapTarget.forBounds and what is it's meaning Rect

i am using this library from Github to make sequence of TapTargetView

https://github.com/KeepSafe/TapTargetView

i want to use the TapTargetSequence but i don't know the first parameter of this " TapTarget.forBounds " in the Sequence example that provided in down page of the link
and don't know the meaning of Rect

and about this library

https://github.com/sjwall/MaterialTapTargetPrompt

i don't know how to sequence of this library

kor kor
Answer

From the source of TapTargetView:

Each tap target describes a target via a pair of bounds and icon. The bounds dictate the location and touch area of the target, where the icon is what will be drawn within the center of the bounds.

You are supposed to provide a Rect object that defines starting point and the area of your target to show the view for. (left, top, right, bottom).

Example of how to create a target rectangle for a view (view is your button):

int[] loc = new int[2];
view.getLocationOnScreen(loc);
Rect rect = new Rect(loc[0], loc[1], loc[0] + view.getWidth(), l[1] + view.getHeight());