public static class Tooltip.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder(android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
Tooltip.Builder |
anchor(android.view.View view)
set tooltip's anchor with position
Tooltip.TOP |
Tooltip.Builder |
anchor(android.view.View view,
int position)
Set tooltip's anchor with tooltip's relative position
|
Tooltip.Builder |
animate(TooltipAnimation animation)
Set show and dismiss animation for the tooltip
|
Tooltip.Builder |
autoAdjust(boolean autoAdjust)
Automatically adjust tooltip layout if it's going out of screen.
|
Tooltip.Builder |
autoCancel(int timeInMilli)
If you want the tooltip to dismiss automatically after a certain amount of time,
set it in milliseconds.
|
Tooltip |
build()
Create a new instance of Tooltip.
|
Tooltip.Builder |
cancelable(boolean cancelable)
Whether the tooltip should be dismissed or not if clicked outside.
|
Tooltip.Builder |
checkForPreDraw(boolean check)
If the anchor is anchored to some view in CoordinatorLayout, we get incorrect data
about its position in the window.
|
Tooltip.Builder |
content(android.view.View view)
set tooltip's content view
|
Tooltip.Builder |
debug(boolean debug)
Show logs
|
Tooltip.Builder |
into(android.view.ViewGroup viewGroup)
Add Tooltip in this view
|
Tooltip |
show()
|
Tooltip.Builder |
withListener(Tooltip.Listener listener)
Attach dismiss listener
|
Tooltip.Builder |
withPadding(int padding)
Margin from the anchor and screen boundaries
|
Tooltip.Builder |
withTip(Tooltip.Tip tip)
Show Tip.
|
public Tooltip.Builder content(@NonNull android.view.View view)
view - Content of the tooltippublic Tooltip.Builder anchor(@NonNull android.view.View view)
Tooltip.TOPview - Anchor viewpublic Tooltip.Builder anchor(@NonNull android.view.View view, int position)
view - Anchor viewposition - position of tooltip relative to the anchor. Tooltip.TOP, Tooltip.RIGHT,
Tooltip.BOTTOM, Tooltip.LEFTpublic Tooltip.Builder into(@NonNull android.view.ViewGroup viewGroup)
viewGroup - ViewGroup root view (parent view) for the tooltippublic Tooltip.Builder cancelable(boolean cancelable)
cancelable - booleanpublic Tooltip.Builder autoAdjust(boolean autoAdjust)
Tooltip.TOP, it will try to position itself
within the bounds of the view in right and left direction. It will not try to adjust itself in top
bottom direction.autoAdjust - booleanpublic Tooltip.Builder withPadding(int padding)
padding - - margin from the screen edge (in pixels).public Tooltip.Builder withListener(@NonNull Tooltip.Listener listener)
listener - dismiss listenerpublic Tooltip.Builder withTip(@NonNull Tooltip.Tip tip)
tip - Tooltip.Tippublic Tooltip.Builder autoCancel(int timeInMilli)
timeInMilli - dismiss timepublic Tooltip.Builder animate(@NonNull TooltipAnimation animation)
animation - TooltipAnimation to be performed while showing and dismissingpublic Tooltip.Builder checkForPreDraw(boolean check)
check - - booleanpublic Tooltip.Builder debug(boolean debug)
debug - booleanpublic Tooltip build()
NullPointerException
if anchorView or rootView or contentView is not assigned.Tooltippublic Tooltip show()
build() and adds tooltip to rootView.
contentView
is drawn based on its LayoutParams. If it does not contain any LayoutParams, new LayoutParams are generated
with WRAP_CONTENT for width and height and added to the Tooltip view.Tooltip