android-target-tooltip
Create Toast like tooltips, but targets can be specified, plus custom properties and features
Top Related Projects
ImageView and FrameLayout with gestures control and position animation
:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.
[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly
(DEPRECATED) Android experiment showing a sinking TextView
A fluent tooltip for Android
Quick Overview
Android-target-tooltip is a library for creating customizable tooltips in Android applications. It allows developers to easily add tooltips to any view in their app, with options for positioning, styling, and animations.
Pros
- Easy to implement and integrate into existing Android projects
- Highly customizable with various styling options and animations
- Supports both programmatic and XML-based implementations
- Lightweight and efficient, with minimal impact on app performance
Cons
- Limited documentation and examples available
- May require additional effort to ensure compatibility with different Android versions and screen sizes
- Not actively maintained, with the last update being several years ago
- Some reported issues with tooltip positioning on certain devices
Code Examples
- Creating a basic tooltip:
TooltipView.create(this)
.anchor(targetView, TooltipView.POSITION_ABOVE)
.text("This is a tooltip")
.show()
- Customizing tooltip appearance:
TooltipView.create(this)
.anchor(targetView, TooltipView.POSITION_RIGHT)
.text("Customized tooltip")
.textColor(Color.WHITE)
.color(Color.BLUE)
.animate(TooltipAnimation.SCALE)
.show()
- Using XML to define a tooltip:
<it.sephiroth.android.library.tooltip.TooltipView
android:id="@+id/tooltip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:tooltip_text="XML-defined tooltip"
app:tooltip_textColor="@android:color/white"
app:tooltip_backgroundColor="@android:color/black"
app:tooltip_animationDuration="500"
app:tooltip_closePolicy="touch_inside" />
Getting Started
To use android-target-tooltip in your project, follow these steps:
- Add the JitPack repository to your project's build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency to your app's build.gradle file:
dependencies {
implementation 'com.github.sephiroth74:android-target-tooltip:2.0.3'
}
-
Sync your project with Gradle files.
-
Start using the TooltipView in your Android app as shown in the code examples above.
Competitor Comparisons
ImageView and FrameLayout with gestures control and position animation
Pros of GestureViews
- Offers a wider range of gesture controls, including pinch-to-zoom and double-tap-to-zoom
- Provides smooth image transitions and animations
- Supports both images and custom views
Cons of GestureViews
- More complex implementation due to its broader feature set
- May have a steeper learning curve for developers new to gesture handling
- Potentially higher resource usage due to advanced animations and transitions
Code Comparison
GestureViews:
val gestureView = findViewById<GestureView>(R.id.gesture_view)
gestureView.controller.settings
.setMaxZoom(3f)
.setDoubleTapZoom(2f)
.setPanEnabled(true)
android-target-tooltip:
new Tooltip.Builder(context)
.anchor(anchorView, Tooltip.Gravity.BOTTOM)
.text("Tooltip text")
.show();
GestureViews focuses on providing a rich set of gesture controls for image and view manipulation, while android-target-tooltip is specifically designed for creating tooltips. GestureViews offers more flexibility in terms of user interaction, but may be overkill for simple tooltip implementations. android-target-tooltip provides a more straightforward API for creating tooltips, making it easier to use for basic tooltip needs.
:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.
Pros of Balloon
- More comprehensive customization options for balloon appearance and behavior
- Built-in support for animations and transitions
- Better documentation and examples
Cons of Balloon
- Larger library size due to additional features
- Steeper learning curve for basic usage
Code Comparison
android-target-tooltip:
val tooltip = Tooltip.make(this,
Tooltip.Builder(101)
.anchor(view, Tooltip.Gravity.BOTTOM)
.closePolicy(ClosePolicy.TOUCH_INSIDE_NO_CONSUME)
.text("This is a tooltip")
.maxWidth(500)
.withArrow(true)
.withOverlay(true)
)
tooltip.show()
Balloon:
val balloon = Balloon.Builder(context)
.setArrowSize(10)
.setArrowPosition(0.7f)
.setWidthRatio(1.0f)
.setHeight(65)
.setTextSize(15f)
.setCornerRadius(4f)
.setAlpha(0.9f)
.setText("This is a balloon")
.build()
balloon.showAlignBottom(anchor)
Summary
Balloon offers more features and customization options, making it suitable for complex tooltip requirements. However, android-target-tooltip may be preferable for simpler use cases due to its lighter weight and easier implementation. Both libraries provide similar core functionality, but Balloon's extensive options and animations come at the cost of a larger library size and potentially more complex setup.
[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly
Pros of ShowcaseView
- More customizable appearance with built-in styling options
- Supports multiple showcase items in a single view
- Offers animation capabilities for smoother transitions
Cons of ShowcaseView
- Less frequent updates and maintenance
- May have compatibility issues with newer Android versions
- Limited documentation and examples compared to android-target-tooltip
Code Comparison
ShowcaseView:
new ShowcaseView.Builder(this)
.setTarget(new ViewTarget(findViewById(R.id.button)))
.setContentTitle("Hello!")
.setContentText("This is a showcase view")
.hideOnTouchOutside()
.build();
android-target-tooltip:
TooltipView.build(this)
.target(findViewById(R.id.button))
.text("This is a tooltip")
.gravity(Gravity.BOTTOM)
.show();
Both libraries offer simple ways to create tooltips or showcase views, but ShowcaseView provides more options for customization in a single builder pattern. android-target-tooltip has a more straightforward API for basic tooltip functionality.
(DEPRECATED) Android experiment showing a sinking TextView
Pros of Titanic
- Simpler API and easier to implement
- Supports custom animations for showing/hiding tooltips
- Lightweight library with minimal dependencies
Cons of Titanic
- Less customization options for tooltip appearance
- Limited positioning options compared to android-target-tooltip
- Lacks advanced features like auto-positioning and anchoring
Code Comparison
android-target-tooltip:
TooltipView tooltip = new TooltipView(this)
.withAnchor(anchorView)
.withText("Tooltip text")
.withGravity(Gravity.BOTTOM)
.withMargin(10)
.show();
Titanic:
Titanic titanic = new Titanic();
TitanicTextView titanicTextView = (TitanicTextView) findViewById(R.id.titanic_tv);
titanic.start(titanicTextView);
Both libraries offer easy-to-use APIs for creating tooltips or animated text views in Android applications. android-target-tooltip provides more comprehensive tooltip functionality with extensive customization options, while Titanic focuses on creating a specific wave animation effect for text views. The choice between the two depends on the specific requirements of your project and the desired visual effects.
A fluent tooltip for Android
Pros of ViewTooltip
- More customization options for tooltip appearance and behavior
- Supports multiple tooltip positions (top, bottom, left, right, auto)
- Easier to implement animations and transitions
Cons of ViewTooltip
- Less mature project with fewer contributors
- May have more limited documentation and community support
- Potentially less stable due to more frequent updates
Code Comparison
ViewTooltip:
ViewTooltip
.on(view)
.position(ViewTooltip.Position.TOP)
.text("Hello World!")
.show()
android-target-tooltip:
TooltipView.build(context)
.target(view)
.text("Hello World!")
.show();
Both libraries offer a fluent API for creating tooltips, but ViewTooltip provides more positioning options out of the box. android-target-tooltip focuses on simplicity, while ViewTooltip offers more customization possibilities at the cost of a slightly more complex API.
ViewTooltip is better suited for projects requiring highly customizable tooltips with various positioning options. android-target-tooltip might be preferable for simpler use cases or projects prioritizing stability and community support.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Android Tooltip
Create Toast like tooltips, physical targets can be specified, or even points on screen. Many additional features and customizations. Just look at the samples Activities.
Installation
Maven
implementation 'it.sephiroth.android.library.targettooltip:target-tooltip-library:**version**'
JitPack
Step 1. Add the JitPack repository to your build file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.sephiroth74:android-target-tooltip:Tag'
}
Get the latest version on JitPack
Usage
val tooltip = Tooltip.Builder(Context)
.anchor(View, Int, Int, Boolean)
.anchor(Int, Int)
.text(CharSequence)
.styleId(Int)
.typeface(Typeface)
.maxWidth(Int)
.arrow(Boolean)
.floatingAnimation(Tooltip.Animation)
.closePolicy(ClosePolicy)
.showDuration(Long)
.fadeDuration(Long)
.overlay(Boolean)
.create()
tooltip
.doOnHidden { }
.doOnFailure { }
.doOnShown { }
.show(View, Tooltip.Gravity, Boolean)
See the inner Builder class for the complete set of options
Customization
Tooltip style can be customized in your style object:
<!-- default style -->
<declare-styleable name="TooltipLayout">
<attr name="ttlm_padding" format="dimension" />
<attr name="ttlm_strokeColor" format="color" />
<attr name="ttlm_backgroundColor" format="color" />
<attr name="ttlm_strokeWeight" format="dimension" />
<attr name="ttlm_cornerRadius" format="dimension" />
<attr name="ttlm_arrowRatio" format="float" />
<attr name="android:textAppearance" />
<attr name="ttlm_overlayStyle" format="reference" />
<attr name="ttlm_elevation" format="dimension" />
<!-- font file path inside your assets folder -->
<attr name="ttlm_font" format="string" />
<!-- textview text gravity -->
<attr name="android:gravity" />
</declare-styleable>
And this is the style for the overlay touch:
<declare-styleable name="TooltipOverlay">
<attr name="android:color" />
<attr name="android:alpha" />
<attr name="ttlm_repeatCount" format="integer" />
<attr name="ttlm_duration" format="integer" />
<attr name="android:layout_margin" />
</declare-styleable>
then pass the style in the Builder method withStyleId(int resId)
Screenshots
License
The MIT License
See LICENSE
Top Related Projects
ImageView and FrameLayout with gestures control and position animation
:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.
[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly
(DEPRECATED) Android experiment showing a sinking TextView
A fluent tooltip for Android
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot