Code example for Canvas

Methods: restore, saveLayerAlpha

0
	} 
 
	@Override 
	protected void dispatchDraw(final Canvas canvas) {
		try { 
			canvas.saveLayerAlpha(null, isEnabled() ? 0xFF : 0x80, Canvas.ALL_SAVE_FLAG);
			super.dispatchDraw(canvas);
			canvas.restore();
		} catch (final NullPointerException e) {
			super.dispatchDraw(canvas);
		} 
	} 
 
	private void addTab(final CharSequence label, final Drawable icon, final int index) {
		// Workaround for not being able to pass a defStyle on pre-3.0 
		final TabView tabView = (TabView) mInflater.inflate(R.layout.vpi__tab, null);
		tabView.init(this, mDisplayLabel ? label : null, mDisplayIcon ? icon : null, index);
		tabView.setFocusable(true);
		tabView.setOnClickListener(mTabClickListener);
		tabView.setOnLongClickListener(mTabLongClickListener);
		tabView.setContentDescription(label);