zoukankan      html  css  js  c++  java
  • Adroid: ProgressBar 的使用

    android:layout_width : 进度跳宽度
    android:max : 进度条设置的最大值,(0,10000)
    android:progress    : 当前进度
    android:secondaryProgress : secondary progress 类似与视频中缓冲显示的那个进度
    progressBarStyleHorizontal : 水平样式

    main.xml文件中
     <ProgressBar android:id="@+id/progress_horizontal"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:max="100"
            android:progress="20"
            android:secondaryProgress="60" />
    

    1 点击increase按钮的时候进度条加一
    2 点击increase_secondary 按钮的时候second progress 加一

    		final ProgressBar progressHorizontal = (ProgressBar) findViewById(R.id.progress_horizontal);
    		Button button = (Button) findViewById(R.id.increase);
    		button.setOnClickListener(new Button.OnClickListener() {
    			public void onClick(View v) {
    				progressHorizontal.incrementProgressBy(1);
    			}
    		});
    
    button = (Button) findViewById(R.id.increase_secondary);
    		button.setOnClickListener(new Button.OnClickListener() {
    			public void onClick(View v) {
    				progressHorizontal.incrementSecondaryProgressBy(1);
    			}
    		});
    

    2  页面标题中的长型进度条

    requestWindowFeature(Window.FEATURE_PROGRESS);//请求一个窗口进度条特性风格

    setContentView(R.layout.main);
    setProgressBarVisibility(true);//设置进度条可视

    setProgress(progressHorizontal.getProgress() * 100);//设置标题栏中前景的一个进度条进度值
    setSecondaryProgress(progressHorizontal.getSecondaryProgress() * 100);//设置标题栏中后面的一个进度条进度值


  • 相关阅读:
    socket使用大全
    UIImageView控件使用(转)
    多线程,socket,http,asihttpRequest,等总结集合
    ios 如何判断字符串含有中文字符?
    修改UISearchBar
    abc222_e Red and Blue Tree(树上差分+01背包)
    2020icpc上海部分题解
    abc215_e Chain Contestant(状压dp)
    bzoj3238 差异(后缀数组+单调栈)
    NCD2019部分题解
  • 原文地址:https://www.cnblogs.com/zhfuliang/p/2369202.html
Copyright © 2011-2022 走看看