나는 초보자이고 나는 내 애플 리케이션에 this example (예를 들어 3 번)를 사용하고 싶습니다.결과 값에 따라 게이지 바늘을 회전하는 방법은 무엇입니까?
0, 1, 2, 3 또는 4가 어떻게 바늘이 따라 이동해야 내 응용 프로그램은 배경에서 약간의 계산을 할 것이며, 결과가 될 것입니다 (바늘은 왼쪽에서 오른쪽으로 이동한다)? 출력을 바탕으로 이
나는 초보자이고 나는 내 애플 리케이션에 this example (예를 들어 3 번)를 사용하고 싶습니다.결과 값에 따라 게이지 바늘을 회전하는 방법은 무엇입니까?
0, 1, 2, 3 또는 4가 어떻게 바늘이 따라 이동해야 내 응용 프로그램은 배경에서 약간의 계산을 할 것이며, 결과가 될 것입니다 (바늘은 왼쪽에서 오른쪽으로 이동한다)? 출력을 바탕으로 이
,이 비디오에서 코드를 사용할 수 있습니다 게이지의 값을 얻기 위해 바늘의 이미지를도 특정 수의 회전 https://www.youtube.com/watch?v=tWCHDoO14aE
나는 시도하지만 didnt는 작동해야합니다. stroke_colors attr을 아래 그림과 같이 변경하여 위 이미지에서와 같이 적절한 색상을 지정하십시오. 1 개 세그먼트 max_val 의미하므로 7 개 색 세그먼트가/7
<FrameLayout
android:layout_width="260dp"
android:layout_height="162dp"
android:background="#354051">
<com.sccomponents.widgets.ScArcGauge
android:id="@+id/gauge"
xmlns:sc="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="30dp"
sc:scc_angle_start="-180"
sc:scc_angle_sweep="180"
sc:scc_stroke_colors="#F7AD36|#8BBE28|#8BBE28|#F7AD36|#F7AD36|#EC4949|#EC4949"
sc:scc_stroke_colors_mode="solid"
sc:scc_stroke_size="30dp"/>
<ImageView
android:id="@+id/indicator"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="29dp"
android:layout_marginLeft="18dp"
android:src="@drawable/indicator"/>
</FrameLayout>
float angle0 = 0;
float angle1 = gauge.percentageToAngle(max_val/7);
float angle2 = gauge.percentageToAngle(max_val/7*3);
float angle3 = gauge.percentageToAngle(max_val/7*5);
float angle4 = gauge.percentageToAngle(max_val);
float angle;
if(cur_val >= 0 && cur_val < max_val/7)
angle = angle0;
else if(cur_val >= max_val/7 && cur_val < max_val/7*3)
angle = angle1;
else if(cur_val >= max_val/7*3 && cur_val < max_val/7*5)
angle = angle2;
else if(cur_val >= max_val/7*5 && cur_val < max_val)
angle = angle3;
else
angle = angle4;
indicator.setRotation(angle);