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);//设置标题栏中后面的一个进度条进度值


  • 相关阅读:
    关于观察者模式和发布/订阅模式
    git:error: Your local changes to the following files would be overwritten by merge:
    node中几个路径的梳理
    centOS 开启服务器后无法访问(大坑啊)
    文件上传简记
    自建nodejs服务器(一:有个服务器)
    nodejs上使用sql
    express笔记
    windows下node配置npm全局路径(踩坑)
    DropMaster
  • 原文地址:https://www.cnblogs.com/zhfuliang/p/2369202.html
Copyright © 2011-2022 走看看