package com.jiuqi.ui.widget; import com.jqyd.uilib.R; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; /** * 自定义progressDialog界面 * @author malingya * */ public class ProgressDialogStyle extends Dialog{ public ProgressDialogStyle(Context context) { super(context); } /** * 得到自定义的progressDialog * @param context * @param msg * @return */ public static Dialog createLoadingDialog(Context context, String msg) { LayoutInflater inflater = LayoutInflater.from(context); View v = inflater.inflate(R.layout.loading_page, null);// 得到加载view LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view);// 加载布局 ProgressBar myproBar = (ProgressBar) v.findViewById(R.id.progressBar); TextView tipTextView = (TextView) v.findViewById(R.id.tipTextView);// 提示文字 if(!TextUtils.isEmpty(msg)){ tipTextView.setText(msg);// 设置加载信息 } Dialog loadingDialog = new Dialog(context, R.style.loading_dialog);// 创建自定义样式dialog loadingDialog.setCancelable(false);// 不可以用“返回键”取消 loadingDialog.setContentView(layout, new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));// 设置布局 return loadingDialog; } @Override public void cancel() { // TODO Auto-generated method stub super.cancel(); } }