本文整理汇总了Java中android.widget.ProgressBar类的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar类的具体用法?Java ProgressBar怎么用?Java ProgressBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressBar类属于android.widget包,在下文中一共展示了ProgressBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.ProgressBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
getSupportActionBar().setTitle(getString(R.string.about));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
progressBar = (ProgressBar) findViewById(R.id.progress);
progressBar.getIndeterminateDrawable()
.setColorFilter(ContextCompat.getColor(this, R.color.colorPrimary), PorterDuff.Mode.SRC_IN);
info_web = (WebView) findViewById(R.id.webview_company_info);
info_web.setBackgroundColor(Color.TRANSPARENT);
info_web.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
info_web.setWebViewClient(new myWebClient());
info_web.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
info_web.getSettings().setJavaScriptEnabled(true);
info_web.getSettings().setDefaultFontSize((int) getResources().getDimension(R.dimen.about_text_size));
String infoText = getString(R.string.company_info_web);
info_web.loadDataWithBaseURL("file:///android_asset/fonts/", getWebViewText(infoText), "text/html", "utf-8", null);
}
示例2: onCreate
import android.widget.ProgressBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPref pref= new SharedPref(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event);
Toolbar toolbar= (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
progressBar= (ProgressBar) findViewById(R.id.progress);
adapter=new ClubEventAdapter(this);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new GridLayoutManager(this,2));
recyclerView.addOnItemTouchListener(new RecyclerItemClickListener(this, new RecyclerItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
Intent i=new Intent(EventActivity.this,ClubActivity.class);
i.putExtra(CLUB_ID,list.get(position).getId());
startActivity(i);
}
}));
showData();
}
示例3: initView
import android.widget.ProgressBar; //导入依赖的package包/类
private void initView() {
mAdapter = new ImagesAdapter(getSupportFragmentManager());
mOkBtn = (Button) findViewById(R.id.image_items_ok);
mGallery = (HackyViewPager) findViewById(R.id.pager);
mProgressBar = (ProgressBar) findViewById(R.id.loading);
mGallery.setAdapter(mAdapter);
mGallery.addOnPageChangeListener(new OnPagerChangeListener());
if (!mNeedEdit) {
View chooseLayout = findViewById(R.id.item_choose_layout);
chooseLayout.setVisibility(View.GONE);
} else {
setOkTextNumber();
mOkBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finishByBackPressed(false);
}
});
}
}
示例4: initView
import android.widget.ProgressBar; //导入依赖的package包/类
private void initView() {
this.mCapacityRoot = findViewById(2131361935);
this.mCapacityTextView = (TextView) findViewById(2131361937);
this.mCapacityPBar = (ProgressBar) findViewById(2131361936);
this.mTipLayout = findViewById(R.id.download_vip_layout);
this.mVipTipTV = (TextView) findViewById(R.id.download_vip_tip);
this.mOpenVipTV = (TextView) findViewById(R.id.download_open_vip_btn);
this.mOpenVipTV.setOnClickListener(new OnClickListener(this) {
final /* synthetic */ MyDownloadActivity this$0;
{
if (HotFix.PREVENT_VERIFY) {
System.out.println(VerifyLoad.class);
}
this.this$0 = this$0;
}
public void onClick(View v) {
LetvVipActivity.launch(this.this$0.mContext, this.this$0.mContext.getResources().getString(2131100645));
StatisticsUtils.statisticsActionInfo(this.this$0.mContext, PageIdConstant.downloadingPage, "0", "vp13", "开通会员", 1, PreferencesManager.getInstance().isVip() ? "vip=1" : "vip=0");
}
});
initNavigationBar();
initViewPager();
}
示例5: CustomViewHolder
import android.widget.ProgressBar; //导入依赖的package包/类
public CustomViewHolder(View itemView) {
super(itemView);
this.coloredCircle = (CircleImageView) itemView.findViewById(R.id.imv_list_item_circle);
this.dateAndTime = (TextView) itemView.findViewById(R.id.lbl_date_and_time);
this.message = (TextView) itemView.findViewById(R.id.lbl_message);
this.loading = (ProgressBar) itemView.findViewById(R.id.pro_item_data);
this.container = (ViewGroup) itemView.findViewById(R.id.root_list_item);
/*
We can pass "this" as an Argument, because "this", which refers to the Current
Instance of type CustomViewHolder currently conforms to (implements) the
View.OnClickListener interface. I have a Video on my channel which goes into
Interfaces with Detailed Examples.
Search "Android WTF: Java Interfaces by Example"
*/
this.container.setOnClickListener(this);
}
示例6: onUpgrading
import android.widget.ProgressBar; //导入依赖的package包/类
private void onUpgrading( final int total, final int progress )
{
if(!isShowing() || isDisconnect)
return;
activity.runOnUiThread( new Runnable()
{
@Override
public void run ()
{
int percent = progress*100/total;
if(percent > 100)
percent = 100;
((TextView)fw_loading_layout.findViewById( R.id.fw_loading_text )).setText( "Sending Fw to Pen.. ");
((TextView)fw_loading_layout.findViewById( R.id.fw_loading_progress_text )).setText( percent+"%");
((ProgressBar)fw_loading_layout.findViewById( R.id.fw_loading_progressbar )).setProgress( percent );
((ProgressBar)fw_loading_layout.findViewById( R.id.fw_loading_progressbar )).setIndeterminate( false );
mBuilder.setContentText( "Sending" ).setProgress( total, progress, false );
mNotifyManager.notify( 0, mBuilder.build() );
}
} );
}
示例7: ImageMessageHolder
import android.widget.ProgressBar; //导入依赖的package包/类
public ImageMessageHolder(Context context, View convertView){
super(context,convertView);
isGif = (TextView) convertView.findViewById(ResourceUtils
.getIdByName(context, "id", "sobot_pic_isgif"));
image = (ImageView) convertView.findViewById(ResourceUtils
.getIdByName(context, "id", "sobot_iv_picture"));
pic_send_status = (ImageView) convertView
.findViewById(ResourceUtils.getIdByName(context, "id",
"sobot_pic_send_status"));
pic_progress = (ProgressBar) convertView
.findViewById(ResourceUtils.getIdByName(context, "id",
"sobot_pic_progress"));
sobot_pic_progress_round = (RoundProgressBar) convertView.findViewById(ResourceUtils.getIdByName(context, "id",
"sobot_pic_progress_round"));
sobot_pic_progress_rl = (RelativeLayout) convertView.findViewById(ResourceUtils.getIdByName(context, "id", "sobot_pic_progress_rl"));
}
示例8: initView
import android.widget.ProgressBar; //导入依赖的package包/类
@Override
public void initView() {
mFloatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.fam_wei_xin_news_menu);
browser = (FloatingActionButton) findViewById(R.id.fab_wei_xin_news_browser);
share = (FloatingActionButton) findViewById(R.id.fab_wei_xin_news_share);
display = (WebView) findViewById(R.id.wv_wei_xin_news_display);
mProgressBar = (ProgressBar) findViewById(R.id.pb_wei_xin_news_load);
findViewById(R.id.rl_wei_xin_news_container).setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mFloatingActionsMenu.isExpanded()) {
mFloatingActionsMenu.collapse();
return true;
} else {
return false;
}
}
});
browser.setOnClickListener(this);
share.setOnClickListener(this);
}
示例9: Holder
import android.widget.ProgressBar; //导入依赖的package包/类
Holder(int adapterPosition, View rootView) {
super(adapterPosition, rootView);
FlingRelativeLayout flingRelativeLayout = (FlingRelativeLayout) rootView.findViewById(R.id.fling_root_view);
flingRelativeLayout.setOnClickListener(v -> toggleFullscreen());
flingRelativeLayout.setOnSingleFlingListener(new CloseOnFlingListener(rootView.getContext()) {
@Override
public boolean onVerticalFling(float distanceByY) {
goBack();
return true;
}
});
mSurfaceView = (SurfaceView) rootView.findViewById(R.id.surface_view);
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.addCallback(this);
mAspectRatioLayout = (AlternativeAspectRatioFrameLayout) rootView.findViewById(R.id.aspect_ratio_layout);
mProgressBar = (ProgressBar) rootView.findViewById(R.id.preparing_progress_bar);
}
示例10: onCreate
import android.widget.ProgressBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user);
SubjectListView = (ListView) findViewById(R.id.listview1);
progressBarSubject = (ProgressBar) findViewById(R.id.progressBar);
new GetHttpResponse(user.this).execute();
trendingBtm = (ImageButton) findViewById(R.id.imageBtmtrending);
userBtm = (ImageButton) findViewById(R.id.imageBtmuser);
locationBtm = (ImageButton) findViewById(R.id.imageBtmlocation);
settingsBtm = (ImageButton) findViewById(R.id.imageBtmSettings);
addReviewBtm = (FloatingActionButton) findViewById(R.id.addReview);
trendingBtm.setOnClickListener(btTrending);
userBtm.setOnClickListener(btUser);
locationBtm.setOnClickListener(btlocation);
settingsBtm.setOnClickListener(btSettings);
addReviewBtm.setOnClickListener(btAdd);
userid = Users.userID;
}
示例11: initView
import android.widget.ProgressBar; //导入依赖的package包/类
private void initView(Context context) {
View.inflate(context, R.layout.dialog_loading_tip, this);
img_tip_logo = (ImageView) findViewById(R.id.img_tip_logo);
progress = (ProgressBar) findViewById(R.id.progress);
tv_tips = (TextView) findViewById(R.id.tv_tips);
bt_operate = (Button) findViewById(R.id.bt_operate);
//重新尝试
bt_operate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(onReloadListener!=null){
onReloadListener.reload();
}
}
});
setVisibility(View.GONE);
}
示例12: showPostPrepareUI
import android.widget.ProgressBar; //导入依赖的package包/类
private void showPostPrepareUI() {
ProgressBar pb = (ProgressBar) findViewById(R.id.spinner);
pb.setVisibility(View.GONE);
mDuration = mPlayer.getDuration();
if (mDuration != 0) {
mSeekBar.setMax(mDuration);
mSeekBar.setVisibility(View.VISIBLE);
}
mSeekBar.setOnSeekBarChangeListener(mSeekListener);
mLoadingText.setVisibility(View.GONE);
View v = findViewById(R.id.titleandbuttons);
v.setVisibility(View.VISIBLE);
mAudioManager.requestAudioFocus(mAudioFocusListener, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
mProgressRefresher.postDelayed(new ProgressRefresher(), 200);
updatePlayPause();
}
示例13: onCreateOptionsMenu
import android.widget.ProgressBar; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.device_list_activity_menu, menu);
if (!btScanner.isScanning()) {
menu.findItem(R.id.menu_stop).setVisible(false);
menu.findItem(R.id.menu_scan).setVisible(true);
menu.findItem(R.id.menu_refresh).setActionView(null);
} else {
menu.findItem(R.id.menu_stop).setVisible(true);
menu.findItem(R.id.menu_scan).setVisible(false);
View indicatorLayout = getLayoutInflater().inflate(R.layout.actionbar_indeterminate_progress, null);
ProgressBar indicator = indicatorLayout.findViewById(R.id.loading_indicator);
indicator.setVisibility(View.VISIBLE);
indicator.setIndeterminate(true);
indicator.getIndeterminateDrawable().setColorFilter(0xFF323232, PorterDuff.Mode.MULTIPLY);
menu.findItem(R.id.menu_refresh).setActionView(indicatorLayout);
}
return true;
}
示例14: onCreate
import android.widget.ProgressBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listener_sample);
mLayout = findViewById(R.id.mainLayout);
final ProgressBar progressBar = findViewById(R.id.progress);
final TextView progressText = findViewById(R.id.progressText);
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
String testFilePath = path + "/testFile";
String url = "http://ipv4.download.thinkbroadband.com/200MB.zip";
new RxDownload(this, 1)
.saveTo(testFilePath)
.listener(progress -> {
progressBar.setProgress(progress);
progressText.setText(Integer.toString(progress));
if(progress == 100)
DialogBuilder.showMessage("Operation Completed", mLayout);
})
.url(url)
.start();
}
示例15: inflateUI
import android.widget.ProgressBar; //导入依赖的package包/类
private void inflateUI() {
setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
LayoutInflater inflater = (LayoutInflater)
getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(
R.layout.paginated_recycler, this, true);
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container);
mRecyclerView = (RecyclerView) view.findViewById(R.id.list);
mProgressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
mEmptyView = (SwipeRefreshLayout) view.findViewById(R.id.empty_view);
mEmptyViewTextView = (TextView) mEmptyView.findViewById(R.id.no_data_message);
}