android自定義轉圈progressbar
因為自帶的progressbar長得太醜了 美工那個醜男不知道從哪偷的帶箭頭的圓圈圖片,讓我自定義ProgressBar。那個醜男簡直人醜事多,真踏嗎s b一個。
簡單講自定義progressbar 總共分三步。
首先在drawable寫個轉圈的xml。 like this,
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android" >
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/cocim_skill_listview_pb"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" />
</rotate>
然後在values資料夾下建立style.xml檔案 裡面寫一個style啥瘠薄玩意 like this
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="cocim_fragment_skill_ppbb" >
<item name="android:indeterminateDrawable">@drawable/cocim_fragment_skill_progressbar</item>
</style>
</resources>
最後在佈局檔案中使用就行了
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:indeterminateDuration="2000"
style="@style/cocim_fragment_skill_ppbb"
android:id="@+id/cocim_fragment_skill_progressbar"
/>
好了寫完了 給美工那個白脖看看 這麼牛逼簡直是在 piapiapia 抽 他臉。