In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "Android how to achieve imitation IOS10 disc time selector", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Android how to achieve imitation IOS10 disc time selector" bar!
Project demonstration
Realization idea
Take 720 degrees as a cycle, 0 °360 °corresponds to 0 °12 hours, 360 °~ 720 °corresponds to 12 hours
Here, take the start time setting button as an example to talk about its sliding implementation:
Use the start time setting button as point A, the center of the dial as point O, and the finger touch point as point P. The size of ∠ AOP can be calculated by the arc tangent formula, and then the position of point A (that is, the angle of point A) can be updated with the continuous change of the position of the finger.
Line expression of / / coordinate system / / expression of line L1: float A1 = mCenterY-mStartBtnCurY;float b1 = mStartBtnCurX-mCenterX;float C1 = mStartBtnCurY * mCenterX-mCenterY * mStartBtnCurX;double D1 = (A1 * eventX + b1 * eventY + C1) / (Math.sqrt (A1 * A1 + b1 * b1)); / / expression of straight line L2: passing through the center point of the clock and perpendicular to the straight line l1 float a2 = b1 Float b2 =-A1; float c2 =-a2 * mCenterX-b2 * mCenterY; double D2 = (a2 * eventX + b2 * eventY + c2) / (Math.sqrt (a2 * a2 + b2 * b2)); / / with L1 as the baseline, the homeopathic semicircle is 0-180 degrees, counterclockwise semicircle is 0-negative 180 degrees double moveDegree = Math.toDegrees (Math.atan2 (D1, D2)); mStartDegree = (float) (mStartDegree + Math.floor (moveDegree)) MStartDegree = (mStartDegree < 0)? MStartDegree + mDegreeCycle: mStartDegree% mDegreeCycle; refreshStartBtnPositon (); invalidate (); Thank you for reading, the above is the content of "Android how to achieve imitation IOS10 disc time selector". After the study of this article, I believe you have a deeper understanding of how to achieve imitation IOS10 disc time selector in Android. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.