您的位置:首页 > 其它

图片旋转(扫描,等待效果)的几种方式

2016-07-25 23:19 218 查看
<ProgressBar
android:id="@+id/progress"
android:indeterminateDrawable="@drawable/rotate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />


drawable中文件 rotate

<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/rotate"
android:pivotX="50%"
android:pivotY="50%" />


没有现成图,则有

<animated-rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="360">

<shape
android:shape="ring"
android:innerRadiusRatio="3"
android:thicknessRatio="8"
android:useLevel="false">
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#6BD3FF"
android:centerColor="#FF7121"
android:centerY="0.50"
android:endColor="#FFFF00" />
</shape>

</animated-rotate>


以上是利用progressBar实现的,也可以直接用补间动画RotateAnimation实现。

RotateAnimation anim = new RotateAnimation//
(0, 360, // 角度
RotateAnimation.RELATIVE_TO_SELF, 0.5f,// 宽
RotateAnimation.RELATIVE_TO_SELF, 0.5f);// 高
anim.setDuration(700);// 时长
anim.setRepeatCount(Integer.MAX_VALUE);
act_img.startAnimation(anim);


多说一下,带进度条的progressbar

<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="15dp"
android:layout_marginTop="3dp"
android:max="100"
android:progress="10"
/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: