I understand it as a map mode

personal

Set the radius of the container, set the default size of the container, set the starting angle, set the number of menus, record the last x, y position, in the modified method public MapModelLayout(Context context, AttributeSet attrs), calculate the mobile phone screen top distance, calculates the radius of the container,

In the onMeasure method, multiply the set radius by 1 / 1f; calculate the size of each View, and set the ViewGroup mode MeasureSpec.EXACTLY

Set the size of each View of the ViewGroup separately and determine whether to show and hide if it is hidden, it will continue to execute

And set and calculate the size of the item; and with the set mode, to measure the item makeMeasureSpec = MeasureSpec.makeMeasureSpec(childSize, childMode);

And set the size of the View separately

Get the radius inside onLayout and angleDelayLeft = 360 / (showNum * 2); get the radian of rotation

Use the Math function to calculate the sine and cosine respectively. According to the default radius and starting angle, you can calculate the distance on the left according to the cosine function. Calculate the distance between View and View according to the zhengxuan. Determine whether it is clockwise or clockwise according to the XY coordinates according to dispatchTouchEvent. Counterclockwise, and then judge in onLayout to remove the data first

if (centTop > centerLine - 50 && centTop < centerLine) {// The above conTao is the Zheng Xuan function and the default size is composed of the default radius and centerLine, and the left and right distances are calculated according to dispatchTouchEvent

if (centTop < centerLine + 50 && centTop > centerLine) {// Similarly, it is concluded that isRight is a member variable

并根据childView.findViewById(R.id.layout_id);设置v.setScaleX((float) (1 + Math.pow(
     Math.cos(Math.toRadians(startAngle)), num)));
   v.setScaleY((float) (1 + Math.pow(
     Math.cos(Math.toRadians(startAngle)), num)));

mum is set to 5, which is also the number displayed on the default page


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325366272&siteId=291194637