Android标题栏TitleBar全攻略
2010-08-20 01:57:00 来源:WEB开发网} else {
mLockIcon.setImageDrawable(d);
mLockIcon.setVisibility(View.VISIBLE);
}
}
void setProgress(int newProgress) {
if (newProgress >= mHorizontalProgress.getMax()) {
mTitle.setCompoundDrawables(null, null, null, null);
((Animatable) mCircularProgress).stop();
mHorizontalProgress.setVisibility(View.INVISIBLE);
if (mBookmarkDrawable != null) {
mRtButton.setImageDrawable(mBookmarkDrawable);
}
mInLoad = false;
} else {
mHorizontalProgress.setProgress(newProgress);
if (!mInLoad && getWindowToken() != null) {
mTitle.setCompoundDrawables(null, null, mCircularProgress,
null);
((Animatable) mCircularProgress).start();
mHorizontalProgress.setVisibility(View.VISIBLE);
if (mBookmarkDrawable == null) {
mBookmarkDrawable = mRtButton.getDrawable();
}
if (mStopDrawable == null) {
mRtButton.setImageResource(R.drawable.ic_btn_stop_v2);
mStopDrawable = mRtButton.getDrawable();
} else {
mRtButton.setImageDrawable(mStopDrawable);
}
mInLoad = true;
}
}
}
void setTitleAndUrl(CharSequence title, CharSequence url) {
if (url == null) {
mTitle.setText(R.string.title_bar_loading);
} else {
mTitle.setText(url.toString());
}
}
void setToTabPicker() {
mTitle.setText(R.string.tab_picker_title);
setFavicon(null);
setLock(null);
mHorizontalProgress.setVisibility(View.GONE);
}
}
本文的相关的title_bar.xml布局文件内容,其中大家可以理解下部分图标在创建时使用隐藏GONE的visibility显示属性,通 过条件来设置其显示
< LinearLayout
更多精彩
赞助商链接