• android 开发 制作弹出等待进度条


    技术点:

    dialog;ProgressBar;animated-rotate;

    弹出框:

    import com.carspeak.client.R;
    
    import android.app.Dialog;
    import android.content.Context;
    import android.graphics.drawable.AnimationDrawable;
    import android.view.Gravity;
    import android.widget.ImageView;
    import android.widget.TextView;
    
    /**
     * 等待进度条
     * @author huqiang
     *
     */
    public class WaitProgressDialog extends Dialog {
        private Context context = null;
        private static WaitProgressDialog wProgressDialog = null;
    
        public WaitProgressDialog(Context context){
            super(context);
            this.context = context;
        }
    
        public WaitProgressDialog(Context context, int theme) {
            super(context, theme);
        }
    
        public static WaitProgressDialog createDialog(Context context){
            wProgressDialog = new WaitProgressDialog(context,R.style.WaitProgressDialog);
            wProgressDialog.setContentView(R.layout.waitprogressdialog);
            wProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER;
    
            return wProgressDialog;
        }
    }

    R.style.WaitProgressDialog:

    <style name="WaitProgressDialog" parent="@style/TipsDialog">
            <item name="android:windowBackground">@android:color/transparent</item>
            <item name="android:windowNoTitle">true</item>
            <item name="android:backgroundDimEnabled">false</item>
        </style>

    R.layout.waitprogressdialog:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="horizontal">
        <ProgressBar
            android:id="@+id/pb_process"
               android:layout_width="40dp"
               android:layout_height="40dp"
               android:layout_gravity="center"
               style="?android:attr/progressBarStyle" 
               android:indeterminate="false"
               android:indeterminateDrawable="@anim/process_round"/>
    </LinearLayout>

    @anim/process_round:

    <?xml version="1.0" encoding="utf-8"?>
    <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"  
        android:drawable="@drawable/ic_loading"  
        android:pivotX="50%"  
        android:pivotY="50%" />
  • 相关阅读:
    NOI2018 你的名字——SAM+线段树合并
    [NOI2008]假面舞会——数论+dfs找环
    CF1037H Security——SAM+线段树合并
    CF700E Cool Slogans——SAM+线段树合并
    CF666E Forensic Examination——SAM+线段树合并+倍增
    [BJOI2019]光线——递推
    ProjectEuler215 Crack-free Walls
    ProjectEuler237 Tours on a 4 x n playing board
    [SCOI2016]美味——主席树+按位贪心
    [ZJOI2013]K大数查询——整体二分
  • 原文地址:https://www.cnblogs.com/feijian/p/4503168.html
Copyright © 2020-2023  润新知