本文整理汇总了Java中android.widget.ProgressBar.setProgressDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar.setProgressDrawable方法的具体用法?Java ProgressBar.setProgressDrawable怎么用?Java ProgressBar.setProgressDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.setProgressDrawable方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateProgress
import android.widget.ProgressBar; //导入方法依赖的package包/类
private void updateProgress(StepProgress progress, View progressStepContainer) {
ProgressBar progBar = Ui.findView(progressStepContainer, R.id.spinner);
ImageView checkmark = Ui.findView(progressStepContainer, R.id.checkbox);
// don't show the spinner again if we've already shown the checkmark,
// regardless of the underlying state that might hide
if (checkmark.getVisibility() == View.VISIBLE) {
return;
}
progressStepContainer.setVisibility(View.VISIBLE);
if (progress.status == StepProgress.STARTING) {
checkmark.setVisibility(View.GONE);
progBar.setProgressDrawable(tintedSpinner);
progBar.setVisibility(View.VISIBLE);
} else {
progBar.setVisibility(View.GONE);
checkmark.setImageDrawable(tintedCheckmark);
checkmark.setVisibility(View.VISIBLE);
}
}
示例2: convertBetteryBitmap
import android.widget.ProgressBar; //导入方法依赖的package包/类
public void convertBetteryBitmap() {
batteryView = (ProgressBar) LayoutInflater.from(mContext).inflate(R.layout.layout_battery_progress, null);
batteryView.setProgressDrawable(ContextCompat.getDrawable(mContext,
SettingManager.getInstance().getReadTheme() < 4 ?
R.drawable.seekbar_battery_bg : R.drawable.seekbar_battery_night_bg));
batteryView.setProgress(battery);
batteryView.setDrawingCacheEnabled(true);
batteryView.measure(View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(26), View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(14), View.MeasureSpec.EXACTLY));
batteryView.layout(0, 0, batteryView.getMeasuredWidth(), batteryView.getMeasuredHeight());
batteryView.buildDrawingCache();
//batteryBitmap = batteryView.getDrawingCache();
// tips: @link{https://github.com/JustWayward/BookReader/issues/109}
batteryBitmap = Bitmap.createBitmap(batteryView.getDrawingCache());
batteryView.setDrawingCacheEnabled(false);
batteryView.destroyDrawingCache();
}
示例3: init
import android.widget.ProgressBar; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
private void init(Context context) {
// 顶部显示的进度条
mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
mProgressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 7, 0, 0));
Drawable drawable = context.getResources().getDrawable(R.drawable.layer_web_progress_bar);
mProgressBar.setProgressDrawable(drawable);
addView(mProgressBar);
WebSettings webSettings = this.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(true); // 是能放大缩小
webSettings.setUseWideViewPort(true);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webSettings.setLoadWithOverviewMode(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);//隐藏
webSettings.setDomStorageEnabled(true);
webSettings.setSupportMultipleWindows(true);
//webSettings.setUseWideViewPort(true);
this.setWebViewClient(mWebViewClientBase);
this.setWebChromeClient(mWebChromeClientBase);
setDownloadListener(new DownloadListener());
this.onResume();
}
示例4: ProgressWebView
import android.widget.ProgressBar; //导入方法依赖的package包/类
public ProgressWebView(Context context, AttributeSet attrs) {
super(context, attrs);
progressbar = new ProgressBar(context, null,
android.R.attr.progressBarStyleHorizontal);
progressbar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
10, 0, 0));
Drawable drawable = context.getResources().getDrawable(R.drawable.progress_bar_states);
progressbar.setProgressDrawable(drawable);
addView(progressbar);
// setWebViewClient(new WebViewClient(){});
setWebChromeClient(new WebChromeClient());
//是否可以缩放
getSettings().setSupportZoom(true);
getSettings().setBuiltInZoomControls(true);
}
示例5: initializeLayout
import android.widget.ProgressBar; //导入方法依赖的package包/类
private void initializeLayout(Context context) {
Resources res = context.getResources();
LayoutInflater.from(context).inflate(R.layout.pulling_progress_layout, this);
mPullingLeftBar = (ProgressBar) findViewById(R.id.pulling_left_progressbar);
mPullingRightBar = (ProgressBar) findViewById(R.id.pulling_right_progressbar);
mPullingLeftBar.setProgressDrawable(res.getDrawable(R.drawable.progress_horizontal_holo_light));
mPullingRightBar.setProgressDrawable(res.getDrawable(R.drawable.progress_horizontal_holo_light));
mPullingLeftBar.setMax(100);
mPullingRightBar.setMax(100);
mPullingLeftBar.setProgress(40);
mPullingRightBar.setProgress(40);
}
示例6: onFinishInflate
import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
// 事先保存子控件显示状态,并隐藏所有子控件
for (int i = 0; i < getChildCount(); i++) {
mVisibilityMap.put(getChildAt(i), getChildAt(i).getVisibility());
if (!mAutoLoadingDebug) {
getChildAt(i).setVisibility(GONE);
}
}
mLoadingBar = new ProgressBar(getContext());
mLoadingBar.setIndeterminate(true);
if (mProgressDrawable != null) {
mLoadingBar.setProgressDrawable(mProgressDrawable);
}
LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.CENTER;
addView(mLoadingBar, params);
if (!mAutoLoadingDebug) {
showLoading();
}
}
示例7: UploadView
import android.widget.ProgressBar; //导入方法依赖的package包/类
public UploadView(Context context, String uploadId, Bitmap bm, String title, String statusText, String pText, int progress) {
super(context);
idView = new TextView(context);
idView.setVisibility(View.GONE);
idView.setText(uploadId + "");
imageView = new ImageView(context);
imageView.setImageBitmap(bm);
imageView.setBackgroundColor(0xFF666666);
imageView.setId(VIDEOIMAGE_ID);
titleView = new TextView(context);
titleView.setText(title);
titleView.setTextColor(0xFF000000);
titleView.setId(TITLEVIEW_ID);
titleView.setPaddingRelative(5, 5, 0, 0);
statusTextView = new TextView(context);
statusTextView.setText(statusText);
statusTextView.setTextColor(0xFF000000);
statusTextView.setId(STATUSVIEW_ID);
statusTextView.setPaddingRelative(5, 5, 0, 0);
statusTextView.setTextColor(Color.GRAY);
progressTextView = new TextView(context);
progressTextView.setText(pText);
progressTextView.setTextColor(0xFF000000);
progressTextView.setId(PROGRESSTEXT_ID);
progressTextView.setPaddingRelative(5, 5, 0, 0);
progressTextView.setTextColor(Color.GRAY);
progressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
progressBar.setMax(100);
progressBar.setIndeterminate(false);
progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar));
progressBar.setId(PROGRESSBAR_ID);
progressBar.setPaddingRelative(5, 0, 0, 0);
progressBar.setProgress(progress);
/**
*
* + + + + title
* + img + 0M / 0M
* + + 下载中
* + + + + ********progress**************
*
* */
//左侧
LayoutParams imageLayoutParams = new LayoutParams(ParamsUtil.dpToPx(context, 75), ParamsUtil.dpToPx(context, 75));
imageLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
//位于图片右侧
LayoutParams titleLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
titleLayoutParams.addRule(RelativeLayout.RIGHT_OF, VIDEOIMAGE_ID);
//位于标题下方
LayoutParams statusLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
statusLayoutParams.addRule(RelativeLayout.BELOW, TITLEVIEW_ID);
statusLayoutParams.addRule(RelativeLayout.RIGHT_OF, VIDEOIMAGE_ID);
//位于状态下方
LayoutParams progressTextParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
progressTextParams.addRule(RelativeLayout.BELOW, STATUSVIEW_ID);
progressTextParams.addRule(RelativeLayout.RIGHT_OF, VIDEOIMAGE_ID);
//位于图片左侧,进度文本下方
LayoutParams progressBarLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, ParamsUtil.dpToPx(context, 7));
progressBarLayoutParams.addRule(RelativeLayout.RIGHT_OF, VIDEOIMAGE_ID);
progressBarLayoutParams.addRule(RelativeLayout.BELOW, PROGRESSTEXT_ID);
progressBarLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
addView(imageView, imageLayoutParams);
addView(titleView, titleLayoutParams);
addView(statusTextView, statusLayoutParams);
addView(progressTextView, progressTextParams);
addView(progressBar, progressBarLayoutParams);
setPadding(5, 5, 5, 5);
}
示例8: initView
import android.widget.ProgressBar; //导入方法依赖的package包/类
private void initView() {
if (isInEditMode())
return;
mProgressBar = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleHorizontal);
mProgressBar.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, PROGRESS_HEIGHT));
mProgressBar.setProgressDrawable(ContextCompat.getDrawable(getContext(), R.drawable.webview_progress_drawable));
mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(0);
addView(mProgressBar);
}
示例9: ProgressWebView
import android.widget.ProgressBar; //导入方法依赖的package包/类
public ProgressWebView(Context context, AttributeSet attrs) {
super(context, attrs);
progressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
progressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
10, 0, 0));
Drawable drawable = context.getResources().getDrawable(R.drawable.progress_bar_states);
progressBar.setProgressDrawable(drawable);
addView(progressBar);
setWebChromeClient(new WebChromeClient());
getSettings().setSupportZoom(true);//支持缩放
getSettings().setBuiltInZoomControls(true);
}
示例10: ProgressWebView
import android.widget.ProgressBar; //导入方法依赖的package包/类
public ProgressWebView(Context context, AttributeSet attrs) {
super(context, attrs);
mProgressBar = new ProgressBar(context, null,
android.R.attr.progressBarStyleHorizontal);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, 8);
mProgressBar.setLayoutParams(layoutParams);
Drawable drawable = context.getResources().getDrawable(
R.drawable.web_progress_bar_states);
mProgressBar.setProgressDrawable(drawable);
addView(mProgressBar);
setWebChromeClient(new WebChromeClient());
}
示例11: ProgressWebView
import android.widget.ProgressBar; //导入方法依赖的package包/类
public ProgressWebView(Context context, AttributeSet attrs) {
super(context, attrs);
mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
mProgressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 8, 0, 0));
Drawable drawable = context.getResources().getDrawable(R.drawable.progressbar_webview);
mProgressBar.setProgressDrawable(drawable);
addView(mProgressBar);
setWebChromeClient(new WebChromeClient());
//是否可以缩放
getSettings().setSupportZoom(true);
getSettings().setBuiltInZoomControls(true);
}
示例12: DownloadView
import android.widget.ProgressBar; //导入方法依赖的package包/类
public DownloadView(Context context, String title, String statusInfo, String progressText, int progress) {
super(context);
titleView = new TextView(context);
titleView.setText(title);
titleView.setTextColor(0xFF000000);
titleView.setId(TITLEVIEW_ID);
titleView.setTextSize(15);
titleView.setSingleLine();
statusInfoView = new TextView(context);
statusInfoView.setText(statusInfo);
statusInfoView.setId(STATUSVIEW_ID);
statusInfoView.setTextColor(0xFF000000);
progressTextView = new TextView(context);
progressTextView.setTextColor(0xFF000000);
progressTextView.setId(PROGRESSTEXT_ID);
progressTextView.setPadding(0, 10, 0, 0);
progressTextView.setText(progressText);
progressTextView.setTextColor(Color.GRAY);
progressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
progressBar.setMax(100);
progressBar.setMinimumHeight(10);
progressBar.setIndeterminate(false);
progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar));
progressBar.setPadding(0, 10, 0, 0);
progressBar.setProgress(progress);
/**
*
* title
* 下载中
* 0M / 0M
* ********progress**************
*
* */
LayoutParams titleLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
titleLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
addView(titleView, titleLayoutParams);
LayoutParams statusInfoLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
statusInfoLayoutParams.addRule(RelativeLayout.BELOW, TITLEVIEW_ID);
statusInfoLayoutParams.addRule(RelativeLayout.ALIGN_LEFT, TITLEVIEW_ID);
addView(statusInfoView, statusInfoLayoutParams);
LayoutParams progressTextLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
progressTextLayoutParams.addRule(RelativeLayout.BELOW, STATUSVIEW_ID);
progressTextLayoutParams.addRule(RelativeLayout.ALIGN_LEFT, TITLEVIEW_ID);
addView(progressTextView, progressTextLayoutParams);
LayoutParams progressLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, 25);
progressLayoutParams.addRule(RelativeLayout.BELOW, PROGRESSTEXT_ID);
progressLayoutParams.addRule(RelativeLayout.ALIGN_LEFT, TITLEVIEW_ID);
addView(progressBar, progressLayoutParams);
setPadding(5, 5, 5, 5);
}
示例13: createProgressBar
import android.widget.ProgressBar; //导入方法依赖的package包/类
private ProgressBar createProgressBar() {
ProgressBar p = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleHorizontal);
p.setLayoutParams(new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
p.setProgressDrawable(ContextCompat.getDrawable(getContext(), R.drawable.progress_bg));
return p;
}
示例14: initProgressBar
import android.widget.ProgressBar; //导入方法依赖的package包/类
private void initProgressBar() {
mPageLoadingProgressBar = (ProgressBar) findViewById(R.id.progressBar1);
mPageLoadingProgressBar.setMax(100);
mPageLoadingProgressBar.setProgressDrawable(this.getResources()
.getDrawable(R.drawable.color_progressbar));
}