Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAndroidMaster committed Feb 4, 2017
1 parent df53613 commit 5b43877
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For testing and experimentation purposes, a sample apk can be downloaded [here](
The Gradle dependency is available through jcenter, which is used by default in Android Studio. To add the module to your project, copy this line into the dependencies section of your build.gradle file.

``` gradle
compile 'james.tooltips:tooltips:0.0.2'
compile 'james.tooltips:tooltips:0.0.3'
```

## Usage
Expand Down Expand Up @@ -45,7 +45,10 @@ tooltip.showFor(x, y); //show the tooltip under the specified coordinates
Again, simply call `tooltip.dismiss();` when you want it to be dismissed.

### Customization
It is also possible to change the position, padding, background shape, background color, and text color of the tooltip.
It is also possible to add an icon, change the position, padding, background shape, background color, icon color, and text color of the tooltip.

#### Icon
To add an icon, pass a drawable to the tooltip using the `Tooltip.setIcon(Drawable)` method. To hide the icon after one has been set, simply call `Tooltip.setIcon(null)`.

#### Position
There are five available positions that the tooltip can be shown in: `Tooltip.Position.ABOVE`, `Tooltip.Position.BELOW`, `Tooltip.Position.LEFT`, `Tooltip.Position.RIGHT`, and `Tooltip.Position.CENTER`. These can be changed using the `Tooltip.setPosition(Position)` method like below.
Expand Down Expand Up @@ -83,6 +86,16 @@ new Tooltip(this)
.attachTo(view);
```

#### Icon Color
The icon color can be changed using the `Tooltip.setIconTint(int, PorterDuff.Mode)` method like below.
``` java
new Tooltip(this)
.setText("Hi!")
.setIcon(drawable)
.setIconTint(Color.BLUE, PorterDuff.Mode.SRC_IN)
.attachTo(view);
```

#### Text Color
The text color can be modified using the `Tooltip.setTextColor(int)` method like below.
``` java
Expand Down

0 comments on commit 5b43877

Please sign in to comment.