本文整理汇总了Java中android.widget.ProgressBar.setIndeterminateDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar.setIndeterminateDrawable方法的具体用法?Java ProgressBar.setIndeterminateDrawable怎么用?Java ProgressBar.setIndeterminateDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.setIndeterminateDrawable方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildLoadingVertical
import android.widget.ProgressBar; //导入方法依赖的package包/类
protected BuildBean buildLoadingVertical(BuildBean bean) {
Dialog dialog = new Dialog(bean.mContext);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
bean.dialog = dialog;
View root = View.inflate(bean.mContext, R.layout.dialogui_loading_vertical, null);
View llBg = (View) root.findViewById(R.id.dialogui_ll_bg);
ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg);
TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg);
tvMsg.setText(bean.msg);
if (bean.isWhiteBg) {
llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum));
tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black));
} else {
llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum_light));
tvMsg.setTextColor(Color.WHITE);
}
bean.dialog.setContentView(root);
return bean;
}
示例2: showLoading
import android.widget.ProgressBar; //导入方法依赖的package包/类
public LoadingView showLoading(CharSequence msg, boolean cancleabl) {
mDialog = new Dialog(mContext);// TODO: 2017/8/28 内存泄露时这里也修改为弱引用
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
rootView = View.inflate(mContext, R.layout.dialogui_loading_horizontal, null);
mLinearLayout = (LinearLayout) rootView.findViewById(R.id.dialogui_ll_bg);
mProgressBar = (ProgressBar) rootView.findViewById(R.id.pb_bg);
mTextView = (TextView) rootView.findViewById(R.id.dialogui_tv_msg);
mTextView.setText(msg);
mLinearLayout.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
mProgressBar.setIndeterminateDrawable(mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress));
mTextView.setTextColor(mContext.getResources().getColor(R.color.text_black));
mDialog.setContentView(rootView);
if (mDialog != null) {
if (mDialog.isShowing()) {
mDialog.dismiss();
}
mDialog.setCancelable(cancleabl);
mDialog.setOnCancelListener(this);
mDialog.show();
}
return this;
}
示例3: buildMdLoadingVertical
import android.widget.ProgressBar; //导入方法依赖的package包/类
protected BuildBean buildMdLoadingVertical(BuildBean bean) {
AlertDialog.Builder builder = new AlertDialog.Builder(bean.mContext);
View root = View.inflate(bean.mContext, R.layout.dialogui_loading_vertical, null);
View llBg = (View) root.findViewById(R.id.dialogui_ll_bg);
ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg);
TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg);
tvMsg.setText(bean.msg);
if (bean.isWhiteBg) {
llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum));
tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black));
} else {
llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum_light));
tvMsg.setTextColor(Color.WHITE);
}
builder.setView(root);
AlertDialog dialog = builder.create();
bean.alertDialog = dialog;
return bean;
}
示例4: buildMdLoadingHorizontal
import android.widget.ProgressBar; //导入方法依赖的package包/类
protected BuildBean buildMdLoadingHorizontal(BuildBean bean) {
AlertDialog.Builder builder = new AlertDialog.Builder(bean.mContext);
View root = View.inflate(bean.mContext, R.layout.dialogui_loading_horizontal, null);
View llBg = (View) root.findViewById(R.id.dialogui_ll_bg);
ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg);
TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg);
tvMsg.setText(bean.msg);
if (bean.isWhiteBg) {
llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress));
tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black));
} else {
llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress_light));
tvMsg.setTextColor(Color.WHITE);
}
builder.setView(root);
AlertDialog dialog = builder.create();
bean.alertDialog = dialog;
return bean;
}
示例5: buildLoadingHorizontal
import android.widget.ProgressBar; //导入方法依赖的package包/类
protected BuildBean buildLoadingHorizontal(BuildBean bean) {
Dialog dialog = new Dialog(bean.mContext);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
bean.dialog = dialog;
View root = View.inflate(bean.mContext, R.layout.dialogui_loading_horizontal, null);
View llBg = (View) root.findViewById(R.id.dialogui_ll_bg);
ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg);
TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg);
tvMsg.setText(bean.msg);
if (bean.isWhiteBg) {
llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress));
tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black));
} else {
llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress_light));
tvMsg.setTextColor(Color.WHITE);
}
bean.dialog.setContentView(root);
return bean;
}
示例6: ChatLoadingCell
import android.widget.ProgressBar; //导入方法依赖的package包/类
public ChatLoadingCell(Context context) {
super(context);
frameLayout = new FrameLayout(context);
frameLayout.setBackgroundResource(R.drawable.system_loader);
frameLayout.getBackground().setColorFilter(Theme.colorFilter);
addView(frameLayout, LayoutHelper.createFrame(36, 36, Gravity.CENTER));
ProgressBar progressBar = new ProgressBar(context);
try {
progressBar.setIndeterminateDrawable(getResources().getDrawable(R.drawable.loading_animation));
} catch (Exception e) {
//don't promt
}
progressBar.setIndeterminate(true);
AndroidUtilities.setProgressBarAnimationDuration(progressBar, 1500);
frameLayout.addView(progressBar, LayoutHelper.createFrame(32, 32, Gravity.CENTER));
}
示例7: PRTHeader
import android.widget.ProgressBar; //导入方法依赖的package包/类
public PRTHeader(Context context) {
super(context);
int[] size = ResHelper.getScreenSize(context);
float screenWidth = size[0] < size[1] ? size[0] : size[1];
float ratio = screenWidth / DESIGN_SCREEN_WIDTH;
setOrientation(VERTICAL);
LinearLayout llInner = new LinearLayout(context);
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.CENTER_HORIZONTAL;
addView(llInner, lp);
ivArrow = new RotateImageView(context);
int resId = ResHelper.getBitmapRes(context, "ssdk_oks_ptr_ptr");
if (resId > 0) {
ivArrow.setImageResource(resId);
}
int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
lp = new LayoutParams(avatarWidth, avatarWidth);
lp.gravity = Gravity.CENTER_VERTICAL;
int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
lp.topMargin = lp.bottomMargin = avataPadding;
llInner.addView(ivArrow, lp);
pbRefreshing = new ProgressBar(context);
resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_progressbar");
Drawable pbdrawable = context.getResources().getDrawable(resId);
pbRefreshing.setIndeterminateDrawable(pbdrawable);
llInner.addView(pbRefreshing, lp);
pbRefreshing.setVisibility(View.GONE);
tvHeader = new TextView(getContext());
tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
tvHeader.setTextColor(0xff09bb07);
lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.CENTER_VERTICAL;
llInner.addView(tvHeader, lp);
}
示例8: makeAllProgressBarsIdle
import android.widget.ProgressBar; //导入方法依赖的package包/类
private static void makeAllProgressBarsIdle(View view) {
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for (int i = 0; i < viewGroup.getChildCount(); i++) {
makeAllProgressBarsIdle(viewGroup.getChildAt(i));
}
} else if (view instanceof ProgressBar) {
ProgressBar progressBar = (ProgressBar) view;
if (progressBar.isIndeterminate()) {
progressBar.setIndeterminateDrawable(ContextCompat.getDrawable(InstrumentationRegistry.getTargetContext(), android.R.drawable.ic_lock_lock));
}
}
}
示例9: PRTHeader
import android.widget.ProgressBar; //导入方法依赖的package包/类
public PRTHeader(Context context) {
super(context);
int[] size = R.getScreenSize(context);
float screenWidth = size[0] < size[1] ? size[0] : size[1];
float ratio = screenWidth / DESIGN_SCREEN_WIDTH;
setOrientation(VERTICAL);
LinearLayout llInner = new LinearLayout(context);
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.CENTER_HORIZONTAL;
addView(llInner, lp);
ivArrow = new RotateImageView(context);
int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr");
if (resId > 0) {
ivArrow.setImageResource(resId);
}
int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
lp = new LayoutParams(avatarWidth, avatarWidth);
lp.gravity = Gravity.CENTER_VERTICAL;
int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
lp.topMargin = lp.bottomMargin = avataPadding;
llInner.addView(ivArrow, lp);
pbRefreshing = new ProgressBar(context);
resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar");
Drawable pbdrawable = context.getResources().getDrawable(resId);
pbRefreshing.setIndeterminateDrawable(pbdrawable);
llInner.addView(pbRefreshing, lp);
pbRefreshing.setVisibility(View.GONE);
tvHeader = new TextView(getContext());
tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
tvHeader.setTextColor(0xff09bb07);
lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.CENTER_VERTICAL;
llInner.addView(tvHeader, lp);
}
示例10: initView
import android.widget.ProgressBar; //导入方法依赖的package包/类
private void initView(BaseViewHolder holder) {
if (holder == null) {
return;
}
holder.setText(R.id.tv_loadingFastLoadMore, mLoadingText)
.setTextColor(R.id.tv_loadingFastLoadMore, mLoadingTextColor)
.setText(R.id.tv_loadFailFastLoadMore, mLoadFailText)
.setTextColor(R.id.tv_loadFailFastLoadMore, mLoadFailTextColor)
.setText(R.id.tv_loadEndFastLoadMore, mLoadEndText)
.setTextColor(R.id.tv_loadEndFastLoadMore, mLoadEndTextColor);
TextView tvLoading = holder.getView(R.id.tv_loadingFastLoadMore);
TextView tvLoadFail = holder.getView(R.id.tv_loadFailFastLoadMore);
TextView tvLoadEnd = holder.getView(R.id.tv_loadEndFastLoadMore);
ProgressBar pbLoading = holder.getView(R.id.pb_loadingFastLoadMore);
tvLoading.setTextSize(TypedValue.COMPLEX_UNIT_PX, mLoadingTextSize);
tvLoading.getPaint().setFakeBoldText(mLoadingTextFakeBold);
tvLoadFail.setTextSize(TypedValue.COMPLEX_UNIT_PX, mLoadFailTextSize);
tvLoadFail.getPaint().setFakeBoldText(mLoadFailTextFakeBold);
tvLoadEnd.setTextSize(TypedValue.COMPLEX_UNIT_PX, mLoadEndTextSize);
tvLoadEnd.getPaint().setFakeBoldText(mLoadEndTextFakeBold);
if (mLoadingSize >= 0) {
pbLoading.getIndeterminateDrawable().setBounds(0, 0, mLoadingSize, mLoadingSize);
ViewGroup.LayoutParams params = pbLoading.getLayoutParams();
params.width = mLoadingSize;
params.height = mLoadingSize;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
pbLoading.setIndeterminateTintList(ColorStateList.valueOf(mLoadingProgressColor));
}
if (mLoadingProgressDrawable != null) {
mLoadingProgressDrawable.setBounds(pbLoading.getIndeterminateDrawable().getBounds());
pbLoading.setIndeterminateDrawable(mLoadingProgressDrawable);
}
}
示例11: disableProgressBarAnimation
import android.widget.ProgressBar; //导入方法依赖的package包/类
/**
* necessary to run tests on older API levels where progress bar uses handler loop to animate.
*
* @param progressBar The progress bar whose animation will be swapped with a drawable
*/
private static void disableProgressBarAnimation(ProgressBar progressBar) {
progressBar.setIndeterminateDrawable(new ColorDrawable(Color.BLUE));
}