https://github.com/douglasjunior/android-simple-tooltip
A simple library based on PopupWindow to create Tooltips on Android. 💚
https://github.com/douglasjunior/android-simple-tooltip
android animation dialog easy-to-use hacktoberfest kiss popup-window tooltip ui
Last synced: 13 days ago
JSON representation
A simple library based on PopupWindow to create Tooltips on Android. 💚
- Host: GitHub
- URL: https://github.com/douglasjunior/android-simple-tooltip
- Owner: douglasjunior
- License: mit
- Created: 2016-05-10T19:51:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-11T00:42:01.000Z (10 months ago)
- Last Synced: 2025-04-12T04:48:05.372Z (about 2 months ago)
- Topics: android, animation, dialog, easy-to-use, hacktoberfest, kiss, popup-window, tooltip, ui
- Language: Java
- Homepage:
- Size: 974 KB
- Stars: 815
- Watchers: 18
- Forks: 192
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Android Simple Tooltip
[PT](https://github.com/douglasjunior/android-simple-tooltip/blob/master/README.pt.md)
[](https://github.com/douglasjunior/android-simple-tooltip/blob/master/LICENSE)
[](https://app.travis-ci.com/douglasjunior/android-simple-tooltip)
[](https://jitpack.io/#douglasjunior/android-simple-tooltip)
[](#download)
[](http://android-arsenal.com/details/1/3578)A simple library based on [PopupWindow](http://developer.android.com/intl/pt-br/reference/android/widget/PopupWindow.html) to create Tooltips on Android.
## Features
- Working from Android 4.0 (API 14)
- Simple to use: few parameters in a single line of code
- Animation with speed and size control
- Option to close with touch inside or outside of the tooltip.
- Modal mode (prevents touch in the background)
- Overlay (darkens the background highlighting the anchor)
- Customizable arrow
- Inflatable content from a `View` or `XML` layout.
- Colors and dimensions customized by `Builder` or `XML` resources## Demo

## Usage
### Basic```java
View yourView = findViewById(R.id.your_view);new SimpleTooltip.Builder(this)
.anchorView(yourView)
.text("Texto do Tooltip")
.gravity(Gravity.END)
.animated(true)
.transparentOverlay(false)
.build()
.show();
```### Resources
```xml
@color/colorAccent
@android:color/primary_text_light
@color/colorAccent
```
```xml
150dp
10dp
10dp
8dp
30dp
15dp
4dp
```
```xml
120
800
```
```xml```
More info on the [sample project](https://github.com/douglasjunior/android-simple-tooltip/blob/master/sample/src/main/java/io/github/douglasjunior/androidSimpleTooltip/sample/MainActivity.java) and [javadoc](https://jitpack.io/com/github/douglasjunior/android-simple-tooltip/master-SNAPSHOT/javadoc/).
## Download
### Release1. Add it in your root `build.gradle` at the end of repositories:
```javascript
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```2. Add the dependency in your `app/build.gradle`:
```javascript
dependencies {
implementation 'com.github.douglasjunior:android-simple-tooltip:1.1.0'
}
```### Snapshot
```javascript
dependencies {
implementation('com.github.douglasjunior:android-simple-tooltip:master-SNAPSHOT') {
changing = true // Gradle will then check for updates every 24 hours
}
}
```## Contribute
New features, bug fixes and improvements in the translation are welcome! For questions and suggestions use the [issues](https://github.com/douglasjunior/android-simple-tooltip/issues).
Before submit your PR, run the gradle check.
```bash
./gradlew build connectedCheck
```
![]()
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E32BUP77SVBA2)## Known issues
1. If you close the `Dialog/Activity` without the Tooltip is closed, there may be the exception `java.lang.IllegalArgumentException: Could not lock surface`. This error occurs because the animation continue for a while after closing the `Dialog/Activity`. (This error does not impact the execution of the app)
2. If you call `tooltip.show()` after `Activity/Dialog` is closed, there may be the exception `android.view.WindowLeaked: Activity has leaked window android.widget.PopupWindow$PopupViewContainer that was originally added here`. [Read more.](http://stackoverflow.com/questions/2850573/activity-has-leaked-window-that-was-originally-added) (This error does not impact the execution of the app)
3. From API 24, Android has changed the behavior of `PopupWindow` in relation to the [`setClippingEnabled`](https://developer.android.com/reference/android/widget/PopupWindow.html#setClippingEnabled(boolean)) property, which causes the Popup to be cut off. [Read more](https://github.com/douglasjunior/android-simple-tooltip/issues/40).
## Star History
[](https://star-history.com/#douglasjunior/android-simple-tooltip&Date)
## Licence
```
The MIT License (MIT)Copyright (c) 2016 Douglas Nassif Roma Junior
```See the full [licence file](https://github.com/douglasjunior/android-simple-tooltip/blob/master/LICENSE).