Closed acorn371 closed 6 years ago
Well, I apologize, i found it, it was my fault!
I wal calling tourGuide.playOn(searchView)
from within Fragment.onCreateOptionsMenu, when target view searchView wasn't layed out yet.
I moved my code in a post-layout event as below:
view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < 16)
view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
else
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
tourGuide = TourGuide.init(getActivity())
.setOverlay(overlay)
.setPointer(new Pointer())
.setToolTip(new ToolTip().setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL).setTitle("Title").setDescription("Description"))
.playOn(searchView);
}
});
And now it works!
Hi, I'd like to show a simple tooltip on a searchView in my fragment. I'm running Androidstudio Emulator with android 7.1.1 and support library. Here the code:
Here the fragment layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical">
At the first time, my tooltip is showed well.![droid screen-1](https://user-images.githubusercontent.com/13482149/31826718-1dcd4480-b5b6-11e7-89c4-d28c39a1861b.png)
When I play it again, the Overlay "hole" is quite bigger and my tooltip is not visible, showing outside the display, i suppose. You can see my tooltip squeezed on the right of the second picture.