layout like spider

2020-03-24 07:56发布

问题:

I want a cylindrical, spider web like layout:

I know that I can use canvas to draw this but I also need all portions to be clickable, and canvas is very hard to handle touch for all portion.

Ideas?

回答1:

can i want layout like spider...

Yes you can want it. But if you want to actually create that layout then you cannot do it with the standard android widgets.

If you want to make it then I would suggest drawing it on a Canvas manually and using the onTouchListener to catch the key presses.



回答2:

I am not sure but i hope this can help you ...

The Path class holds a set of vector-drawing commands such as lines, rectangles, and curves. Here’s an example that defines a circular path:

circle = new Path();
circle.addCircle(150, 150, 100, Direction.CW);

This defines a circle at position x=150, y=150, with a radius of 100 pixels. Now that we’ve defined the path, let’s use it to draw the circle’s outline plus some text around the inside:

private static final String QUOTE = "Now is the time for all " +
"good men to come to the aid of their country." ;
canvas.drawPath(circle, cPaint);
canvas.drawTextOnPath(QUOTE, circle, 0, 20, tPaint);

You can see the result in this Figure

If you want to get really fancy, Android provides a number of PathEffect classes that let you do things such as apply a random permutation to a path, cause all the line segments along a path to be smoothed out with curves or broken up into segments, and create other effects.