当前位置: 首页>>代码示例>>Java>>正文


Java ProgressBar.setVisibility方法代码示例

本文整理汇总了Java中android.widget.ProgressBar.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar.setVisibility方法的具体用法?Java ProgressBar.setVisibility怎么用?Java ProgressBar.setVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ProgressBar的用法示例。


在下文中一共展示了ProgressBar.setVisibility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View bodyView = inflater.inflate(R.layout.fragment_home, container, false);

    scanProgressbar = (ProgressBar) bodyView.findViewById(R.id.scan_progressbar);
    scanProgressbar.setIndeterminate(true);
    scanProgressbar.setVisibility(GONE);
    pandwarfConnectedTextView = (TextView) bodyView.findViewById(R.id.pandwarf_connected_text_view);
    listView = (ListView) bodyView.findViewById(R.id.pandwarf_list_view);
    listView.setAdapter(new ListAdapterCustom(getContext(), 0, new ArrayList<ExtendedBluetoothDevice>()));
    scanIsRunning = new AtomicBoolean(false);
    connexionInProgress = new AtomicBoolean(false);
    connectionButton = (Button) bodyView.findViewById(R.id.connection_button);
    resetFragment();

    return bodyView;
}
 
开发者ID:GRnice,项目名称:PandwarfDefenderProject,代码行数:19,代码来源:HomeFragment.java

示例2: handleMessage

import android.widget.ProgressBar; //导入方法依赖的package包/类
public void handleMessage(Message msg) {
    if (msg.what == MSG_SIZE_COMPUTED) {
        ArrayList<Object> list = (ArrayList<Object>) msg.obj;
        if (msg.arg1 == -1 && msg.arg2 == -1) {
            // Size is computed, hide the progressbar
            ProgressBar pb = (ProgressBar) list.get(1);
            pb.setVisibility(View.GONE);
        } else {
            // Size is beeing computed => display the current total
            TextView sizeTv = (TextView) list.get(0);
            TextView numberFilesTv = (TextView) list.get(2);
            sizeTv.setText(Formatter.formatFileSize(mC, (Long) list.get(3)));
            if (msg.arg1 == 0 && msg.arg2 == 0) {
                numberFilesTv.setText(R.string.file_info_directory_empty);
            } else {
                numberFilesTv.setText(InfoDialog.formatDirectoryInfo(mC, msg.arg1,
                        msg.arg2));
            }
        }
    }
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:22,代码来源:InfoDialog.java

示例3: onPostExecute

import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
protected void onPostExecute(ClassifyTaskResult result) {
    ProgressBar progressSpinner = (ProgressBar)findViewById(R.id.loadingSpinner);
    progressSpinner.setVisibility(View.GONE);

    if (result != null) {
        // If not null send the full result from ToneAnalyzer to our UI Builder class.
        RecognitionResultBuilder resultBuilder = new RecognitionResultBuilder(MainActivity.this);
        LinearLayout resultLayout = (LinearLayout) findViewById(R.id.recognitionResultLayout);

        if(resultLayout != null){
            resultLayout.removeAllViews();
        }
        LinearLayout recognitionView = resultBuilder.buildRecognitionResultView(result.getVisualClassification(), result.getDetectedFaces());

        resultLayout.addView(recognitionView);
    }
}
 
开发者ID:sebros,项目名称:vollDeinBier,代码行数:19,代码来源:MainActivity.java

示例4: onCreateView

import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_asynctask, container, false);
    logsView = (LinearLayout) rootView.findViewById(R.id.logs);
    progressView = (ProgressBar) rootView.findViewById(R.id.progressBar);
    progressView.setVisibility(View.GONE);
    rootView.findViewById(R.id.start_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (asyncTask != null) {
                asyncTask.cancel(true);
            }

            asyncTask = new ImportAsyncTask(AsyncTaskFragment.this);
            asyncTask.execute();
        }
    });

    return rootView;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:AsyncTaskFragment.java

示例5: initUI

import android.widget.ProgressBar; //导入方法依赖的package包/类
public void initUI() {
    // Initialize UI Views
    Button enableLocation = (Button) findViewById(R.id.enable_location);
    TextView permissionText = (TextView) findViewById(R.id.permission_text);
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);

    // Initialize button click listeners
    enableLocation.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            requestForLocationSettings();
        }
    });

    // Ask for enabling location permissions and location services to proceed further
    if (!HyperTrack.checkLocationPermission(this) || !HyperTrack.checkLocationServices(this)) {
        progressBar.setVisibility(View.INVISIBLE);
        permissionText.setVisibility(View.VISIBLE);
        enableLocation.setVisibility(View.VISIBLE);
    }

    // Start animation for ripple view
    final ImageView locationRippleView = (ImageView) findViewById(R.id.location_ripple);
    AnimationUtils.ripple(locationRippleView);
}
 
开发者ID:hypertrack,项目名称:hypertrack-live-android,代码行数:26,代码来源:SplashScreen.java

示例6: onCreate

import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
  progressBar = (ProgressBar) findViewById(R.id.progress_bar);
  editText = (EditText) findViewById((R.id.edittext_query));

  progressBar.setIndeterminate(true);
  progressBar.setVisibility(View.VISIBLE);

  recyclerView.setLayoutManager(new LinearLayoutManager(MainActivity.this));
  recyclerView.addItemDecoration(new DividerItemDecoration(MainActivity.this,
      DividerItemDecoration.VERTICAL));

  apiService = ApiClient.getClient().create(ApiInterface.class);
}
 
开发者ID:GurpreetSK95,项目名称:rx-examples-android,代码行数:18,代码来源:MainActivity.java

示例7: instantiateItem

import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = getLayoutInflater().inflate(R.layout.viewpager_very_image, container, false);
    PhotoView zoom_image_view = (PhotoView) view.findViewById(R.id.zoom_image_view);
    ProgressBar spinner = (ProgressBar) view.findViewById(R.id.loading);
    spinner.setVisibility(View.GONE);
    if (imageId != 0) {
        zoom_image_view.setImageResource(imageId);
    }
    zoom_image_view.setOnPhotoTapListener(ViewBigImageActivity.this);
    container.addView(view, 0);
    return view;
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:14,代码来源:ViewBigImageActivity.java

示例8: showDownload

import android.widget.ProgressBar; //导入方法依赖的package包/类
private void showDownload(int position) {
    VideoDownLoadInfo item = data.get(position);
    item.setDownLoading(true);
    adapter.setDownPosition(position);
    ProgressBar seekBar = (ProgressBar) adapter.getViewByPosition(position, R.id.sb_progress);
    TextView size = (TextView) adapter.getViewByPosition(position, R.id.tv_pause);
    size.setText(StringUtils.getPrintSize(item.getCurrentBytes() == null ? 0 : item.getCurrentBytes(), false) + "/" + StringUtils.getPrintSize(item.getContentLength() == null ? 0 : item.getContentLength(), true));
    seekBar.setVisibility(View.VISIBLE);
    seekBar.setIndeterminate(false);
    seekBar.setProgress(data.get(position).getPercent());
}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:12,代码来源:CacheFragment.java

示例9: 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);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:41,代码来源:PRTHeader.java

示例10: buildWebChromeClient

import android.widget.ProgressBar; //导入方法依赖的package包/类
public WebChromeClient buildWebChromeClient(final ProgressBar progressBar) {
    return new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            progressBar.setProgress(newProgress);
            progressBar.setVisibility(newProgress < 100 ? ProgressBar.VISIBLE : ProgressBar.GONE);
        }
    };
}
 
开发者ID:mgilangjanuar,项目名称:GoSCELE,代码行数:11,代码来源:BrowserPresenter.java

示例11: getView

import android.widget.ProgressBar; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.item_phone, parent, false);

        pb = (ProgressBar)view.findViewById(R.id.progressBar);

        //Display phone name in the TextView widget
        final SmartPhone smartPhone = phoneList.get(position);
        TextView tv = (TextView) view.findViewById(R.id.textView1);
        tv.setText(smartPhone.getProductName());

        //Tampilkan foto hape didalam widget ImageView
        Bitmap bitmap = imageCache.get(smartPhone.getProductId());
        if (bitmap != null){
            ImageView image = (ImageView) view.findViewById(R.id.imageView1);
            image.setImageBitmap(smartPhone.getBitmap());
            pb.setVisibility(View.INVISIBLE);
        }else {
            PhoneAndView container = new PhoneAndView();
            container.phone = smartPhone;
            container.view = view;

            pb.setVisibility(View.VISIBLE);
            ImageLoader loader = new ImageLoader();
            loader.execute(container);
        }

        return view;

    }
 
开发者ID:rkndika,项目名称:AsynTask-WebService,代码行数:32,代码来源:PhoneAdapter.java

示例12: setBusy

import android.widget.ProgressBar; //导入方法依赖的package包/类
private void setBusy(boolean busy) {
    ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBarforArticle);
    if (busy) {
        progressBar.setVisibility(View.VISIBLE);
    } else {
        progressBar.setVisibility(View.INVISIBLE);
    }
}
 
开发者ID:njitdev,项目名称:sa-android,代码行数:9,代码来源:AnnouncementsArticleActivity.java

示例13: initDialog

import android.widget.ProgressBar; //导入方法依赖的package包/类
private void initDialog() {

        LayoutInflater inflater = LayoutInflater.from(mContext);
        View mProgressDialogView = inflater.inflate(R.layout.mn_progress_bar_dialog_layout, null);// 得到加载view
        mDialog = new Dialog(mContext, R.style.MNCustomDialog);// 创建自定义样式dialog
        mDialog.setCancelable(false);// 不可以用“返回键”取消
        mDialog.setCanceledOnTouchOutside(false);
        mDialog.setContentView(mProgressDialogView);// 设置布局

        //设置整个Dialog的宽高
        DisplayMetrics dm = new DisplayMetrics();
        WindowManager windowManager = ((Activity) mContext).getWindowManager();
        windowManager.getDefaultDisplay().getMetrics(dm);
        int screenW = dm.widthPixels;
        int screenH = dm.heightPixels;

        WindowManager.LayoutParams layoutParams = mDialog.getWindow().getAttributes();
        layoutParams.width = screenW;
        layoutParams.height = screenH;
        mDialog.getWindow().setAttributes(layoutParams);

        //获取布局
        dialog_window_background = (RelativeLayout) mProgressDialogView.findViewById(R.id.dialog_window_background);
        dialog_view_bg = (RelativeLayout) mProgressDialogView.findViewById(R.id.dialog_view_bg);
        tvShow = (TextView) mProgressDialogView.findViewById(R.id.tvShow);
        horizontalProgressBar = (ProgressBar) mProgressDialogView.findViewById(R.id.horizontalProgressBar);
        circularProgressBar = (MCircularProgressBar) mProgressDialogView.findViewById(R.id.circularProgressBar);

        horizontalProgressBar.setVisibility(View.GONE);
        circularProgressBar.setVisibility(View.GONE);

        horizontalProgressBar.setProgress(0);
        horizontalProgressBar.setSecondaryProgress(0);
        circularProgressBar.setProgress(0);
        tvShow.setText("");

        //默认配置
        configView();

    }
 
开发者ID:maning0303,项目名称:MNProgressHUD,代码行数:41,代码来源:MProgressBarDialog.java

示例14: getView

import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	LayoutInflater inflater = (LayoutInflater) parent.getContext()
	        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	
	View fileView = convertView!=null?convertView:inflater.inflate(R.layout.file_listitem, parent, false);

	TextView txtName = (TextView)fileView.findViewById(R.id.listFileName);
	TextView txtSize = (TextView)fileView.findViewById(R.id.listFileSize);
	
	AndroidFonts.setViewFont(txtName, RetroBoxUtils.FONT_DEFAULT_R);
	AndroidFonts.setViewFont(txtSize, RetroBoxUtils.FONT_DEFAULT_R);
	
	ImageView icon = (ImageView)fileView.findViewById(R.id.listFileIcon);
	ProgressBar iconLoading = (ProgressBar)fileView.findViewById(R.id.listFileLoading);

	VirtualFile vf = (VirtualFile)getItem(position);
	if (vf.isLoading()) {
		iconLoading.setVisibility(View.VISIBLE);
		icon.setVisibility(View.GONE);
		txtName.setText(fileView.getContext().getString(R.string.folder_loading));
	} else {
		boolean isParent = vf.isParent();

		String name = vf.getFriendlyName();
		if (isParent) {
			if (name == null || name.isEmpty())	name = "..";
		} else if (name == null) {
			name = vf.getName();
		}
		txtName.setText(name);
		
		if ((vf.isDirectory() && vf.getSize() == 0) || vf.getSize() < 0) {
			txtSize.setVisibility(View.GONE);
		} else {
			txtSize.setText(RetroBoxUtils.size2human(vf.getSize()));
			txtSize.setVisibility(View.VISIBLE);
		}
		
		icon.setImageResource(isParent ? R.drawable.ic_navigate_before_white_36dp : vf.getIconResourceId());
		icon.setVisibility(View.VISIBLE);
		iconLoading.setVisibility(View.GONE);
	}
	
	return fileView;
}
 
开发者ID:fcatrin,项目名称:retroxlibs,代码行数:47,代码来源:FileListAdapter.java

示例15: open

import android.widget.ProgressBar; //导入方法依赖的package包/类
public void open(final Context context)
{
    History.add(context, this.url);

    final ProgressBar progressBar = ((Activity) context).findViewById(R.id.progressBar);
    progressBar.setVisibility(View.VISIBLE);


    //start a new thread to do network stuff
    new Thread(new Runnable()
    {
        @Override
        public void run()
        {
            //handler to the main thread
            final Handler handler = new Handler(Looper.getMainLooper());

            ///Network stuff to save the video to cache
            File file = new File(context.getExternalCacheDir() + "/" +
                    context.getPackageName().replace('/', '-'));
            try
            {
                //create the file
                file.createNewFile();

                //start new connection
                Connection conn = new Connection(server, port);

                //get the desired video
                conn.getBinary(selector, file);


            }
            catch (final IOException e)
            {
                //inform the user of the error and exit
                e.printStackTrace();
                handler.post(new Runnable()
                {
                    @Override
                    public void run()
                    {
                        Toast toast = Toast.makeText(context.getApplicationContext(),
                                e.getMessage(),
                                Toast.LENGTH_LONG
                        );
                        toast.show();
                    }
                });
                return;
            }


            handler.post(new Runnable()
            {
                @Override
                public void run()
                {
                    //make the progress bar invisible
                    progressBar.setVisibility(View.GONE);
                }
            });

            //make and start an intent to call the media player
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //needed for API 19
            intent.setDataAndType(Uri.fromFile(file), "audio/*");
            ((Activity) context).setResult(Activity.RESULT_OK, intent);
            context.startActivity(intent);
        }
    }).start();
}
 
开发者ID:afonsotrepa,项目名称:PocketGopher,代码行数:74,代码来源:AudioPage.java


注:本文中的android.widget.ProgressBar.setVisibility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。