Android uses floating windows to prompt users for operations

Last time, we implemented the functional introduction of new users using viewpager. Today, we will show the guidance of users using floating windows. Look at the renderings first.

Although the interface is ugly, we can see that we can still realize better operation tips for users. The following describes how to achieve this effect.

Integrated environment

In this project, I use the tourguide open source project, which can directly enter the GitHub address for learning and downloading. Here we just briefly introduce how to use it to achieve the guidance effect of the floating interface. First, add references: add the following dependencies in your gradle file, and then click sync to add the dependencies to your project.

The simplest use

Through these lines of code, you can achieve the effect of guidance. Here is a brief introduction to the parameters:

*Setpointer () - set the indicator. For how to change the appearance (the white dot that prompts the user to click in the effect picture), refer to the following code. If you don't want a pointer, you can directly pass in null* Settooltip - set the content of the prompt. For how to change its style, refer to my later code. If you don't want a tooltip, you can pass in null* Setoverlay - sets the style of the overlay layer. If you change its style, refer to my later code. If you don't want to, you can pass in null* With - tourguide is currently used Technique. Click, you can remove it later* Mtourguidehandler - the type of handler returned, and the user removes the prompt.

Custom prompt style

Customize the tooltip style. The comments in the code are detailed and should be understandable.

Customize overlay and pointer styles.

I believe the code has been clearly annotated. Finally, copy the code of the whole project.

Code in XML file

Finally, here is the source code: https://github.com/Reoger/StartUITest

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>