In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.