Android 进度条 ProgressBarWithText

码农软件 · 软件分类 · Android UI 组件 · 2019-04-26 16:13:01

软件介绍

ProgressBarWithText 是 Android 上带文本的进度条。

效果演示:

image

image

使用方法: 在布局文件配置:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:progress="http://schemas.android.com/apk/res/org.loader.progressbarwithtext"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
    <org.loader.progressbarwithtext.ProgressBarWithText
        android:id="@+id/progress"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:
layout
_marginTop="50dip"
        progress:textColor="#FFFF0000" />
</RelativeLayout>

只有一个属性:progress:textColor 指定文本颜色

在Activity中:

public class MainActivity extends Activity {
private ProgressBarWithText mProgress;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mProgress = (ProgressBarWithText) findViewById(R.id.progress);
    mProgress.setMax(100);

    new MyAsyncTask().execute();
}

class MyAsyncTask extends AsyncTask<Void, Integer, Void> {
    @Override
    protected Void doInBackground(Void... params) {
        for(int i=0;i<101;i++) {
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            publishProgress(i);
        }
        return null;
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        mProgress.setProgress(values[0]);
    }
}

}


本文地址:https://www.codercto.com/soft/d/4437.html

iOS编程实战

iOS编程实战

[美] Rob Napier、[美] Mugunth Kumar / 美团移动 / 人民邮电出版社 / 2014-9 / 79.00元

本书深入介绍iOS 7新特性和新功能,涵盖iOS 7大部分新增特性,包括新的后台操作、Core Bluetooth、UIKit动力学以及TextKit。另外还介绍了如何处理新的扁平化UI,并新增了一章你可能不知道的“小技巧”。如果读者熟练掌握C和C++,读完本书即可创建性能优异的iPhone、iPad和iPod touch应用。 本书主要内容包括:  iOS 7新特性和新功能概览; ......一起来看看 《iOS编程实战》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

随机密码生成器
随机密码生成器

多种字符组合密码