zoukankan      html  css  js  c++  java
  • 安卓学习18(ProgressBar(进度条))

    1、学习进度条:

    2、目标任务:

    学习Android——ProgressBar(进度条)

    3、预计时间:

    1天

    4、完成情况:

    (1)简介:ProgressBar继承与View类,直接子类有AbsSeekBar和ContentLoadingProgressBar, 其中AbsSeekBar的子类有SeekBar和RatingBar,可见这二者也是基于ProgressBar实现的

    (2)属性:

    • android:max:进度条的最大值
    • android:progress:进度条已完成进度值
    • android:progressDrawable:设置轨道对应的Drawable对象
    • android:indeterminate:如果设置成true,则进度条不精确显示进度
    • android:indeterminateDrawable:设置不显示进度的进度条的Drawable对象
    • android:indeterminateDuration:设置不精确显示进度的持续时间
    • android:secondaryProgress:二级进度条,类似于视频播放的一条是当前播放进度,一条是缓冲进度,前者通过progress属性进行设置!

    (3)相关使用方法:

    • getMax():返回这个进度条的范围的上限
    • getProgress():返回进度
    • getSecondaryProgress():返回次要进度
    • incrementProgressBy(int diff):指定增加的进度
    • isIndeterminate():指示进度条是否在不确定模式下
    • setIndeterminate(boolean indeterminate):设置不确定模式下

    布局代码

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".MainActivity">
    
        <!-- 系统提供的圆形进度条,依次是大中小 -->
    
        <ProgressBar
            style="@android:style/Widget.ProgressBar.Small"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    
        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    
        <ProgressBar
            style="@android:style/Widget.ProgressBar.Large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    
        <!--系统提供的水平进度条-->
        <ProgressBar
            style="@android:style/Widget.ProgressBar.Horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:max="100"
            android:progress="18" />
    
        <ProgressBar
            style="@android:style/Widget.ProgressBar.Horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:indeterminate="true" />
    
    </LinearLayout>

    5、遇到问题:

    学习资料参考:2.3.7 ProgressBar(进度条) | 菜鸟教程 (runoob.com)

  • 相关阅读:
    ORM中的事务和锁
    双下划线跨表查询 聚集查询 分组查询 FQ查询
    cookie和session
    多表查询
    单表查询
    ORM
    Djangon之模板
    Django之视图函数
    Django之URL路由系统
    web框架的本质及自定义web框架
  • 原文地址:https://www.cnblogs.com/Lizhichengweidashen/p/14904530.html
Copyright © 2011-2022 走看看