缓冲进度条或加载进度条,在加载页面或者视频加载过程中,为了做到更好的UI及App功能体验交互,这些缓冲加载的等待效果是必不可少的;
下面来看一下旋转的动画效果:那么,他们的具体源码在这里:loading_1:
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:toDegrees="1080.0" > <shape android:innerRadiusRatio="3" android:shape="ring" android:thicknessRatio="8" android:useLevel="false" > <gradient android:centerColor="#FFDC35" android:centerY="0.50" android:endColor="#CE0000" android:startColor="#FFFFFF" android:type="sweep" android:useLevel="false" /> </shape> </rotate>
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item > <rotate android:drawable="@drawable/movie_loading" android:fromDegrees="0.0" android:pivotX="50.0%" android:pivotY="50.0%" android:toDegrees="1080.0" /> </item> </layer-list>loading_3:
<?xml version="1.0" encoding="UTF-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false" > <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_01" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_02" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_03" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_04" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_05" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_06" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_07" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_08" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_09" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_10" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_11" android:gravity="left" /> </item> <item android:duration="150"> <clip android:clipOrientation="horizontal" android:drawable="@drawable/loading_12" android:gravity="left" /> </item> </animation-list>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:gravity="center_horizontal" android:background="#222222"> <ProgressBar android:id="@+id/loading_1" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginTop="60dp" android:indeterminate="false" android:padding="5dp" android:indeterminateDrawable="@drawable/loading_1" /> <ProgressBar android:id="@+id/loading_2" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginTop="60dp" android:indeterminate="false" android:padding="5dp" android:indeterminateDrawable="@drawable/loading_2" /> <ProgressBar android:id="@+id/loading_3" android:layout_width="50dp" android:layout_height="50dp" android:indeterminate="false" android:layout_marginTop="60dp" android:padding="5dp" android:indeterminateDrawable="@drawable/loading_3" /> </LinearLayout>不需要在Activity.java中添加任何代码,已经搞定!
后待续。。。
原文地址:http://blog.csdn.net/junhuahouse/article/details/39153483