以下內(nèi)容給大家介紹Android中自定義水平進(jìn)度條樣式之黑色虛線,對代碼實(shí)現(xiàn)方法感興趣的朋友一起學(xué)習(xí)吧。
布局layout中使用:
<ProgressBarandroid:id="@+id/progress_bar"style="?android:attr/progressBarStyleHorizontal" <!--必須設(shè)置為水平-->android:progressDrawable="@drawable/myprogress" <!--此處用自定義樣式-->android:layout_width="dp"android:layout_height="dp"android:layout_marginTop="dp"android:maxHeight="dp"android:minHeight="dp"android:max=""android:secondaryProgress=""android:progress=""android:indeterminateOnly="false" />
下面為xml源代碼myprogress.xml:
<?xml version="." encoding="utf-"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android" ><!--item background與progress 順序不可顛倒 --><item android:id="@android:id/background" ><shape android:shape="line"><strokeandroid:width="dp" android:color="#" <!--背景顏色和寬度-->android:dashWidth="dp" android:dashGap="dp" /> <!--虛線間隔dp--></shape> </item><item android:id="@android:id/progress" ><clip><shape android:shape="line"><strokeandroid:width="dp" android:color="#" android:dashWidth="dp" android:dashGap="dp" /> </shape></clip></item></layer-list>
以上所述是本文給大家分享的Android中自定義水平進(jìn)度條樣式之黑色虛線 的相關(guān)知識,希望對大家有所幫助!
新聞熱點(diǎn)
疑難解答
圖片精選