Skip to content

Commit

Permalink
Merge pull request florent37#62 from sanedev/master
Browse files Browse the repository at this point in the history
Fix bug, if rootView has globalOffset, ViewTooltip be off to the bottom.
  • Loading branch information
florent37 authored Dec 27, 2018
2 parents 0e4b753 + d918e5d commit 27e72f7
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
Expand Down Expand Up @@ -167,12 +168,15 @@ public TooltipView show() {
@Override
public void run() {
final Rect rect = new Rect();
view.getGlobalVisibleRect(rect);
final Point offset = new Point();
view.getGlobalVisibleRect(rect, offset);

int[] location = new int[2];
view.getLocationOnScreen(location);
rect.left = location[0];
//rect.left = location[0];
if (offset != null) {
rect.top -= offset.y;
}

decorView.addView(tooltip_view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

Expand Down

0 comments on commit 27e72f7

Please sign in to comment.