當前位置: 首頁>>代碼示例>>Java>>正文


Java ProgressBar.setProgressDrawable方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:26,代碼來源:ConnectingActivity.java

示例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();
}
 
開發者ID:ynztlxdeai,項目名稱:TextReader,代碼行數:18,代碼來源:PageFactory.java

示例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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:CustomWebView.java

示例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); 
}
 
開發者ID:guzhigang001,項目名稱:Bailan,代碼行數:17,代碼來源:ProgressWebView.java

示例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);
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:18,代碼來源:PullingProgressLayout.java

示例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();
    }
}
 
開發者ID:xiong-it,項目名稱:LoadingLayout,代碼行數:27,代碼來源:LoadingLayout.java

示例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);

}
 
開發者ID:lbbniu,項目名稱:CCDownload,代碼行數:81,代碼來源:UploadView.java

示例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);
}
 
開發者ID:chendongMarch,項目名稱:uikit,代碼行數:11,代碼來源:XWebView.java

示例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);
}
 
開發者ID:zwf779375807,項目名稱:progresswebview,代碼行數:13,代碼來源:ProgressWebView.java

示例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());
}
 
開發者ID:zwf779375807,項目名稱:progresswebview,代碼行數:15,代碼來源:ProgressWebView.java

示例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);
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:14,代碼來源:ProgressWebView.java

示例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);
}
 
開發者ID:lbbniu,項目名稱:CCDownload,代碼行數:62,代碼來源:DownloadView.java

示例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;
}
 
開發者ID:RahulJanagouda,項目名稱:StatusStories,代碼行數:7,代碼來源:StoryStatusView.java

示例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));
}
 
開發者ID:banwenmang,項目名稱:X5web,代碼行數:7,代碼來源:BrowserActivity.java


注:本文中的android.widget.ProgressBar.setProgressDrawable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。