WEB开发网
开发学院手机开发Android 开发 Android标题栏TitleBar全攻略 阅读

Android标题栏TitleBar全攻略

 2010-08-20 01:57:00 来源:WEB开发网   
核心提示:}int x = (int) event.getX();int titleRight = mTitleBg.getRight();if (mTitleBg.isPressed() && x > titleRight + slop) {mTitleBg.setPressed(false);mHandler.remo

}

int x = (int) event.getX();

int titleRight = mTitleBg.getRight();

if (mTitleBg.isPressed() && x > titleRight + slop) {

mTitleBg.setPressed(false);

mHandler.removeMessages(LONG_PRESS);

} else if (mRtButton.isPressed() && x < titleRight - slop) {

mRtButton.setPressed(false);

}

break;

case MotionEvent.ACTION_CANCEL:

mRtButton.setPressed(false);

mTitleBg.setPressed(false);

mHandler.removeMessages(LONG_PRESS);

break;

case MotionEvent.ACTION_UP:

if (mRtButton.isPressed()) {

if (mInLoad) {

mBrowserActivity.stopLoading();

} else {

mBrowserActivity.bookmarksOrHistoryPicker(false);

}

mRtButton.setPressed(false);

} else if (mTitleBg.isPressed()) {

mHandler.removeMessages(LONG_PRESS);

mBrowserActivity.onSearchRequested();

mTitleBg.setPressed(false);

}

break;

default:

break;

}

return true;

}

boolean isInLoad() {

return mInLoad;

}

void setFavicon(Bitmap icon) {

Drawable[] array = new Drawable[3];

array[0] = new PaintDrawable(Color.BLACK);

PaintDrawable p = new PaintDrawable(Color.WHITE);

array[1] = p;

if (icon == null) {

array[2] = mGenericFavicon;

} else {

array[2] = new BitmapDrawable(icon);

}

LayerDrawable d = new LayerDrawable(array);

d.setLayerInset(1, 1, 1, 1, 1);

d.setLayerInset(2, 2, 2, 2, 2);

mFavicon.setImageDrawable(d);

}

void setLock(Drawable d) {

if (null == d) {

mLockIcon.setVisibility(View.GONE);

上一页  1 2 3 4 5 6  下一页

Tags:Android 标题 TitleBar

编辑录入:coldstar [复制链接] [打 印]
赞助商链接