我想在imageview周围绘制动画的循环进度。取决于%百分比值作为输入。 例如,如果我给出70%,它应该在imageview周围画出70%(252度)的圆圈。 任何帮助赞赏。
答案 0 :(得分:1)
我遇到过同样的情况,尝试使用此循环进度视图https://github.com/rahatarmanahmed/CircularProgressView,您可以设置每次上传进度的百分比。
答案 1 :(得分:0)
https://android-arsenal.com/details/1/1446 这将有助于创建圈子进度指示器。你可以从上面找到Github链接。
答案 2 :(得分:0)
这里有一个小工具:https://android-arsenal.com/details/1/1446 这将为您提供制作圆形进度视图的功能,该视图根据您的进度绘制圆弧角度。有一个分步指南,可以将它包含在您的项目中。
要将ImageView放在progrss圆圈的中心,您只需使用RelativeLayout将其准确放置在您需要的位置即可。在这个例子中,我将ImageView放在屏幕的中央。这是布局xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.robert.androidmodule.MainActivity">
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:indeterminate="false"
android:max="100"
android:progress="100"
android:progressDrawable="@drawable/circle_progress_background" />
<ProgressBar
android:id="@+id/circle_progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:indeterminate="false"
android:max="100"
android:progressDrawable="@drawable/circle_progress_foreground"
android:rotation="-90" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
app:srcCompat="@mipmap/ic_launcher" />
</RelativeLayout>
在这个例子中,我使用了基本的android图标。
Here is a picture of it working.
希望这有帮助!