Android imitation wechat long press menu effect

This example shares the specific code displayed by Android imitation wechat long press menu for your reference. The specific contents are as follows

FloatMenu

A menu style pop-up window that mimics WeChat。 Long press menu imitating wechat.

The effect is as follows

Introduction method:

GitHub address: https://github.com/JavaNoober/FloatMenu

instructions

Usage 1:

Activity rewrites dispatchtouchevent, creates a new point object, and passes in the modified object during show

Call:

Usage 2:

The dispatchtouchevent does not need to be rewritten, but the clicked view needs to be passed in during initialization. The floatment initialization must be outside the clicked event

How to set the menu:

1. Code setting

2. Menu.xml settings

Methods provide the width of the parameter setting menu:

Create menu:

Note:

There are two ways to display floatmenu:

The difference between floatmenu. Show (point) and floatmenu. Show ()

The difference is that the location where the floatmenu object is created. If the second method is used, the floatmenu must be created outside the click event

The first has no such limitation, as follows:

What is the difference between new floatmenu (this, view) and new floatmenu (this)

To create an object using the second method, you must override dispatchtouchevent

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
分享
二维码
< <上一篇
下一篇>>