Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlay is not Visible in Fragment #104

Open
javiyavandan opened this issue Dec 29, 2016 · 1 comment
Open

Overlay is not Visible in Fragment #104

javiyavandan opened this issue Dec 29, 2016 · 1 comment

Comments

@javiyavandan
Copy link

javiyavandan commented Dec 29, 2016

I am using tooltip library to show Guide tour in my app. My Whole app works with fragments. On right side of action bar i have button which opens Drawer menu . I want to show tooltip options in my Fragment . Here is a code which i have used to show tooltip.

@Override
   public View onCreateView(LayoutInflater inflater, ViewGroup container,
                            Bundle savedInstanceState) {
       if (rootView != null) {
           ViewGroup parent = (ViewGroup) rootView.getParent();
           if (parent != null) {
               parent.removeView(rootView);
           }
       } 
else 
{
           if (rootView == null) {
               rootView = inflater.inflate(R.layout.fragment_networks, container, false);
         
       mSearchEditText = (EditText) rootView.findViewById(R.id.et_search_fragment_networks);

     TourGuide mTourGuideHandler = TourGuide.init(getActivity()).
                       with(TourGuide.Technique.Click).setPointer(new Pointer()).setToolTip(new ToolTip().setTitle("Welcome!")
                       .setDescription("Click on Get Started to begin...")).setOverlay(new Overlay(true,R.color.red, Overlay.Style.Rectangle)).playOn(mSearchEditText);


           }
       }
       return rootView;
   }

When i run app i can't see any overlay on screen . But i can see tooltip on perfect position . Can you help me to solve this issue ? I can see Overlay in Kitkat but i can't see overlay in Lolipop and above versions.
Thanks

@acorn371
Copy link

I had a similar problem.
I think mSearchEditText isn't layed out yet, inside onCreateView method and TourGuide can't compute EditText size and position well.
Try something like:

mSearchEditText = (EditText) rootView.findViewById(R.id.et_search_fragment_networks);

mSearchEditText.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    public void onGlobalLayout() {
        if (Build.VERSION.SDK_INT < 16)
            mSearchEditText.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        else
            mSearchEditText.getViewTreeObserver().removeOnGlobalLayoutListener(this);

	TourGuide mTourGuideHandler = TourGuide.init(getActivity()).with(TourGuide.Technique.Click)
		.setPointer(new Pointer())
		.setToolTip(new ToolTip().setTitle("Welcome!")
			                .setDescription("Click on Get Started to begin..."))
		.setOverlay(new Overlay(true,R.color.red, Overlay.Style.Rectangle))
		.playOn(mSearchEditText);
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants