本文整理匯總了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;
}
示例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));
}
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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());
}
示例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);
}
示例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);
}
};
}
示例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;
}
示例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);
}
}
示例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();
}
示例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;
}
示例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();
}