• 安卓学习第21课——TitlerogressBar


    <RelativeLayout 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">
    
        <Button
            android:id="@+id/bn1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:text="显示" />
    
        <Button
            android:id="@+id/bn2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:text="隐藏" />
        
    </RelativeLayout>
    package com.example.titleprogressbar;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.view.Window;
    import android.widget.Button;
    
    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            //设置窗口特征,启用显示进度的进度条
            requestWindowFeature(Window.FEATURE_PROGRESS);
            //设置窗口特征,启用不显示进度的进度条
            requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
            setContentView(R.layout.activity_main);
            Button bn1=(Button) findViewById(R.id.bn1);
            Button bn2=(Button) findViewById(R.id.bn2);
            bn1.setOnClickListener(new OnClickListener(){
                @Override
                public void onClick(View v) {
                //显示不带进度的进度条
                    setProgressBarIndeterminateVisibility(true);
                    //显示带进度的进度条
                    setProgressBarVisibility(true);
                    //设置进度条的进度
                    setProgress(4500);
                }
                
            });
            bn2.setOnClickListener(new OnClickListener(){
    
                @Override
                public void onClick(View v) {
                    //隐藏不带进度的进度条
                    setProgressBarIndeterminateVisibility(false);
                    //隐藏带进度的进度条
                    setProgressBarVisibility(false);
                    
                }
                
            });
        }
    }
  • 相关阅读:
    word 软换行与硬换行
    正态分布(normal distribution)与偏态分布(skewed distribution)
    hdu1043Eight (经典的八数码)(康托展开+BFS)
    TCP和UDP的区别
    SDUT2608(Alice and Bob)
    The Six Types of Rails Association
    排序算法c语言描述---堆排序
    Jenkins的plugin开发
    SDUTRescue The Princess(数学问题)
    【数据库系列】之存储过程与触发器
  • 原文地址:https://www.cnblogs.com/Yvettey-me/p/3934907.html
Copyright © 2020-2023  润新知