Android Radial / Pie Menu

后端 未结 2 1299
清歌不尽
清歌不尽 2020-12-16 02:43

I am looking to create a radial menu in a game that I am writing. Is there a class or API included to assist with this or an open source solution?

Something like th

2条回答
  •  情话喂你
    2020-12-16 03:26

    There's no built in API for such menus, however, there's at least two ways to do this

    1) Build a layout representing your "menu" and attach it to the "FrameLayout" at the root of your android view. By adjusting the positioning of the element just before you make it visible, you can move it around the scree. This method is a little "hacky", but it should work.

    2) Build a completely custom component, including your own drawing methods and onTouch events, and attach it to your view. This method is quite a bit more complex (you'll need to implement all of the drawing methods), but is also somewhat more general.

    In either case, remember that you'll need to consider how the radial menu functions when the user is using the trackball/d-pad.

提交回复
热议问题