1.res\anim.loading.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_loading"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="100dp"
android:layout_height="100dp"
style="@style/progressbar_style"/>
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_below="@+id/progress_bar"
android:lines="1"
android:text="等待蓝牙连接……"
android:textSize="8sp"
android:gravity="center"/>
</RelativeLayout>
</LinearLayout>
2.values\Style.xml
<!-- loading 动画-->
<style name="progressbar_style">
<item name="android:maxWidth">50.0dip</item>
<item name="android:maxHeight">50.0dip</item>
<item name="android:indeterminateDrawable">@anim/anim_loading</item>
<item name="android:minWidth">50.0dip</item>
<item name="android:minHeight">50.0dip</item>
</style>
3. anim\anim.loading.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/loading"
android:fromDegrees="-720"
android:duration="400"
android:toDegrees="0"
android:pivotX="50.0%"
android:pivotY="50.0%"/>