Commit 3b960565 authored by wanglei's avatar wanglei

...

parent 1aacfe19
......@@ -20,6 +20,7 @@ class ColorProgress : View {
private var centerY = 0f
private var radius = 0f
private var strokeWidth = 0f // 圆环的宽度
private var margin = 10f
private lateinit var ringRectF: RectF
private lateinit var progressRectF: RectF
......@@ -62,7 +63,7 @@ class ColorProgress : View {
// 初始化圆的中心点和半径
centerX = width / 2.0f
centerY = height / 2.0f
radius = centerX.coerceAtMost(centerY) - strokeWidth / 2 // 减去一半的描边宽度以避免超出边界
radius = (centerX.coerceAtMost(centerY) - strokeWidth / 2) - margin
}
......@@ -71,7 +72,7 @@ class ColorProgress : View {
super.onSizeChanged(w, h, oldw, oldh)
centerX = w / 2.0f
centerY = h / 2.0f
radius = centerX.coerceAtMost(centerY) - strokeWidth / 2
radius = (centerX.coerceAtMost(centerY) - strokeWidth / 2) - margin
ringRectF = RectF(centerX - radius, centerY - radius, centerX + radius, centerY + radius)
progressRectF = RectF(centerX - radius, centerY - radius, centerX + radius, centerY + radius)
......
......@@ -123,7 +123,6 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:orientation="horizontal"
android:padding="5dp"
tools:ignore="UseCompoundDrawables">
......@@ -151,7 +150,6 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:orientation="horizontal"
android:padding="5dp"
tools:ignore="UseCompoundDrawables">
......@@ -179,7 +177,6 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:orientation="horizontal"
android:padding="5dp"
tools:ignore="UseCompoundDrawables">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment