国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Android > 正文

Android編程之自定義ProgressBar示例

2019-10-22 18:29:59
字體:
供稿:網(wǎng)友

本文實例講述了Android編程自定義ProgressBar。分享給大家供大家參考,具體如下:

<?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:innerRadiusRatio="3"    android:shape="ring"    android:thicknessRatio="30"    android:useLevel="false">    <gradient      android:centerColor="#FFFFFF"      android:centerY="0.01"      android:endColor="#FFFFFF"      android:startColor="#000000"      android:type="sweep"      android:useLevel="false"/>  </shape></rotate>
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/base_wait_dialog2" android:gravity="center" android:padding="8dp" android:orientation="vertical">  <ProgressBar android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_gravity="center"    android:indeterminateDrawable="@drawable/wait_progressbar"    android:layout_marginTop="6dp"/>  <TextView    android:id="@+id/loadingTextView"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:textColor="#FFFFFF"    android:textSize="16dp"    android:layout_marginTop="10dp"    android:layout_marginLeft="6dp"    android:layout_marginRight="6dp"    android:layout_marginBottom="6dp"    android:gravity="center"    android:text="正在加載,請稍等.."/></LinearLayout>

這是ProgressBar控件,直接用android:indeterminateDrawable去引用上面的文件就可以了.

<ProgressBar    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_gravity="center_horizontal"    android:indeterminateDrawable="@drawable/wel_act_loading_pro"    />

gradient里的屬性沒什么好介紹的, 這里主要是shape.

下列屬性只在android:shape="ring"時使用:

android:innerRadiux
尺寸值,它用尺寸值或尺寸資源指定圓環(huán)內(nèi)部的半徑(指中間的圓孔的半徑)。

android:innerRadiusRatio
浮點值,它用圓環(huán)寬度的比率來表示內(nèi)部圓環(huán)的半徑。例如,如果android:innerRadiusRatio="5",那么內(nèi)部半徑就等于圓環(huán)的寬度除以5。這個值會被android:innerRadius的值覆蓋。默認(rèn)是9。

android:thickness
尺寸值,它用一個尺寸值或尺寸資源來定義圓環(huán)的厚度。

android:thicknessRatio
浮點值。它用圓環(huán)寬度的比率來表示圓環(huán)的厚度。例如,如果android:thicknessRatio="2",那么厚度就等于圓環(huán)的寬度除以2。這個值會被android:innerRadius覆蓋。默認(rèn)值是3。也就是說這個值設(shè)置的越大圓環(huán)就越細(xì)了。

android:useLevel
布爾值,如果這個形狀要用于LevelListDrawable對象,那么就設(shè)置為true。通常應(yīng)該設(shè)置為false或者讓形狀不可見。

希望本文所述對大家Android程序設(shè)計有所幫助。


注:相關(guān)教程知識閱讀請移步到Android開發(fā)頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 兴国县| 米脂县| 乐业县| 涞水县| 嘉荫县| 南阳市| 西丰县| 石台县| 盈江县| 阳春市| 淮阳县| 井陉县| 富宁县| 霸州市| 周宁县| 昌都县| 尚义县| 阿巴嘎旗| 彭州市| 吐鲁番市| 宜春市| 井陉县| 隆回县| 龙门县| 古蔺县| 阿瓦提县| 黄浦区| 锦州市| 伊宁市| 彝良县| 天峻县| 铜鼓县| 五河县| 安福县| 沙坪坝区| 平泉县| 县级市| 宜丰县| 金寨县| 花垣县| 永川市|