我调整了https://github.com/daCapricorn/ArcMenu库以使其工作符合我的目的,并且工作正常。无论如何我可以像在tumblr应用程序中那样构建一个菜单,还是可以通过调整ArcMenu项目或https://github.com/siyamed/android-satellite-menu来实现?我对用于创建样式的数学函数有疑问。
我正在寻找类似于tumblr app动画的动画。
答案 0 :(得分:2)
答案 1 :(得分:1)
我在iOS中有很多方法可以做到这一点。在iOS中我们有类似于Android的视图,我们可以指定坐标(视图)将它们放在超级视图中。
假设:
1)假设你有一个轨迹,即方程x ^ 2 + y ^ 2 = c的圆 (提示:所有视图都在此位置,即所有视图的中心与此圆圈重合)
2)您需要根据您需要的曲线和初始点选择C值 (0,HEIGHT_OF_SCREEN)作为放置视图的说明点。
算法:
int angularDisplacementBetweenEachView = 10; // distance between two views in radians // coordinates of X button in your screen int startPositionOfViewX = 0; int startPositionOfViewY = HEIGHT_OF_SCREEN; // constant to decide curve int C = 125;-(void) main (){ // this is generally done in view controller
for(int i = 1; i< menu_items.count; i++){ Rect position = getCoordinatesForView(menu_item.get(i),menu_item.get(i-1).rect.x,menu_item.get(i-1).rect.y); addView(menu_item.get(i),position.x,position.y); }
}
// method returns the coordinates (x,y) at which the view is required to be //placed. -(Rect)getCoordinatesForView(View currentView, int prevViewX, int prevViewY){
// convert to polar cordinates // refer diagram
// this is also the radius of the virtual circle float r = sqrt(pow(x,2),pow(y,2)); float theta = atan(y,x);
//r & theta are polar coordinates of previous menu item float theta2 = (angularDisplacementBetweenEachView + r*theta)/r;
// convert back to cartesian coordinates int x2 = r * cos (theta); int y2 = r * sin (theta);
return new rect(x2,y2); }
答案 2 :(得分:0)
尝试使用Arc菜单。你可以用这个卫星菜单 https://github.com/ketanpatel25/android-satellite-menu-center