GithubHelp home page GithubHelp logo

nbwzlyd / android-progressbarwidthnumber Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hongyangandroid/android-progressbarwidthnumber

0.0 2.0 0.0 1.34 MB

继承ProgressBar实现的两种风格的滚动条,非常容易理解。

License: Apache License 2.0

Java 100.00%

android-progressbarwidthnumber's Introduction

Android-ProgressBarWidthNumber

通过继承ProgressBar实现的两种风格的滚动条,代码简洁易懂。

效果图

HorizontalProgressBarWithNumber

横向滚动条模仿了daimajia的滚动条风格。 Sample Screenshots

RoundProgressBarWidthNumber

Sample Screenshots

用法

布局文件

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:zhy="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="25dp" >
  
    <com.zhy.view.HorizontalProgressBarWithNumber
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dip"
        android:padding="5dp"
        android:progress="10"
        zhy:progress_text_color="#ff2903FC"
        zhy:progress_unreached_color="#ffBCB4E8" />


    <com.zhy.view.HorizontalProgressBarWithNumber
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dip"
        android:background="#44ff0000"
        android:padding="5dp"
        android:progress="70"
        zhy:progress_reached_bar_height="20dp"
        zhy:progress_text_color="#ffF53B03"
        zhy:progress_unreached_color="#00F7C6B7" />
</LinearLayout>

</ScrollView>

Activity中

package com.zhy.sample.progressbar;

import com.zhy.view.HorizontalProgressBarWithNumber;
import com.zhy.view.RoundProgressBarWidthNumber;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;

public class MainActivity extends Activity {

	private HorizontalProgressBarWithNumber mProgressBar;
	private static final int MSG_PROGRESS_UPDATE = 0x110;

	private Handler mHandler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			int progress = mProgressBar.getProgress();
			mProgressBar.setProgress(++progress);
			if (progress >= 100) {
				mHandler.removeMessages(MSG_PROGRESS_UPDATE);
			}
			mHandler.sendEmptyMessageDelayed(MSG_PROGRESS_UPDATE, 100);
		};
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mProgressBar = (HorizontalProgressBarWithNumber) findViewById(R.id.id_progressbar01);
		mHandler.sendEmptyMessage(MSG_PROGRESS_UPDATE);

	}

}

#关于我

我的博客地址

android-progressbarwidthnumber's People

Contributors

hongyangandroid avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.