Как достичь круговой шкалы прогресса?
В настоящее время я работаю над проектом Android, в котором мне нужен индикатор выполнения, который будет отображаться.
Как достичь круговой шкалы прогресса?
В настоящее время я работаю над проектом Android, в котором мне нужен индикатор выполнения, который будет отображаться.
Попробуйте добавить это в файл XML макет:
<ProgressBar android:id="@+id/progressBar" android:layout_width="wrap_content" android:layout_height="wrap_content" />
Является ли это то, что Вы имели в виду?
Вы можете попробовать this Circle Progress library
CircularProgress:
<com.github.lzyzsd.circleprogress.CircleProgress
android:id="@+id/circle_progress"
android:layout_marginLeft="50dp"
android:layout_width="100dp"
android:layout_height="100dp"
custom:circle_progress="20"/>
CircleProgress:
<com.github.lzyzsd.circleprogress.CircleProgress
android:id="@+id/circle_progress"
android:layout_marginLeft="50dp"
android:layout_width="100dp"
android:layout_height="100dp"
custom:circle_progress="20"/>
ArcProgress:
<com.github.lzyzsd.circleprogress.ArcProgress
android:id="@+id/arc_progress"
android:background="#214193"
android:layout_marginLeft="50dp"
android:layout_width="100dp"
android:layout_height="100dp"
custom:arc_progress="55"
custom:arc_bottom_text="MEMORY"/>
Используйте этот код
public class CustomAlertDia extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//crated new alert dialog
Dialog alertDialog = new Dialog(this);
alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
alertDialog.setContentView(R.layout.progress_dia);
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); //transperent background
ImageView hero = (ImageView)alertDialog.findViewById(R.id.iv_progress);
//setup rotate background effect
RotateAnimation ro = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
ro.setDuration(1500);
ro.setRepeatCount(Animation.INFINITE);
ro.setInterpolator(new LinearInterpolator());
hero.setAnimation(ro);
alertDialog.show();
}
}
Вы можете взять this image и проверить его
Нет, я хочу, индикатор таким же образом, как показано на рисунке. Я тоже пробовал с пользовательским индикатором выполнения, но не использовал. –