对于我的android应用程序,我想在circular progress bar
中放置一个图像。预期设计:
http://hpics.li/cd6acba
有什么办法吗?
-
创建动画xml:
<?xml version="1.0" encoding="utf-8"?> <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/progress_bar" android:pivotX="50%" android:pivotY="50%" />
-
将以下内容设置为布局xml中的进度条视图:
android:indeterminateDrawable="@animator/progressbar_animation"
您可以使用一个普通布局文件:loader.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:clickable="false">
<ProgressBar
android:id="@+id/progressBar1"
style="@android:style/Widget.ProgressBar.Small.Inverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:layout_centerInParent="true"
android:padding="30dp"
android:clickable="false"/>
<ImageView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/img"
android:clickable="false"/>
</RelativeLayout>
根据你的设计做一些小的调整。
现在使用此布局作为进度对话框的可绘制内容。