我需要一个看起来像旋转进度圆的可绘制对象。我想在GridView中的ImageView等控件中使用该可绘制对象。
因此,根据其他帖子的说法,我从文件夹\sdk\platforms\android-xx\data\res\drawable中获取了progress_medium_holo.xml,它的样子是这样的。我也复制了被该可绘制对象使用的PNG文件。
因此,根据其他帖子的说法,我从文件夹\sdk\platforms\android-xx\data\res\drawable中获取了progress_medium_holo.xml,它的样子是这样的。我也复制了被该可绘制对象使用的PNG文件。
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:drawable="@drawable/spinner_48_outer_holo"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="1080" />
</item>
<item>
<rotate
android:drawable="@drawable/spinner_48_inner_holo"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="720"
android:toDegrees="0" />
</item>
</layer-list>
在我的布局中,我使用了这个ImageView,它使用进度可绘制对象。
<ImageView
android:id="@+id/element_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:src="@drawable/progress_medium_holo" />
但结果是一个静态的圆形进度条。有没有一种方法通过XML定义来实现动画效果,而不需要编写代码?