1、自定义ProgressBar
- 这个默认是不会旋转的,所以直接在外面加了一个旋转动画。
custom_progress.xml
<?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="360" >
<shape
//圆环的内部的半径
android:innerRadius="12dp"
//圆环
android:shape="ring"
//圆环的厚度
android:thickness="3dp"
//去掉 progressBar自带的效果
android:useLevel="false" >
<gradient
//中间的渐变色
android:centerColor="#3f00"
//开始的颜色
android:endColor="#f00"
//结束的颜色
android:startColor="#fff" />
</shape>
</rotate>
<ProgressBar
android:id="@+id/pb_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
//引用自己自定义的progressBar android:indeterminateDrawable="@drawable/custom_progress"
android:layout_gravity="center"
android:visibility="invisible" />
2、自定义图片边框
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="1dp"
android:color="@color/bg_btn_cancel_color" />
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<corners android:radius="3dp" />
</shape>
<ImageView
android:id="@+id/iv_takewaiting_img"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="fitXY"
android:background="@drawable/bg_contains_frame" />