Code example for LinearLayout

Methods: getLayoutParams, getVisibility, setVisibility

0
				.getSupportFragmentManager(); 
		mgr.beginTransaction().replace(R.id.appView, replacement).commit();
	} 
 
	public boolean isOpen() { 
		return mFanView.getVisibility() == VISIBLE && !isClosing;
	} 
 
	public void setAnimationDuration(int duration) {
		animDur = duration;
	} 
 
	public void setFadeOnMenuToggle(boolean fade) {
		this.fade = fade;
	} 
 
	public void setIncludeDropshadow(boolean include) {
		if (include) {
			findViewById(R.id.dropshadow).setVisibility(VISIBLE);
		} else { 
			findViewById(R.id.dropshadow).setVisibility(GONE);
		} 
	} 
 
	public void showMenu() { 
		if (mFanView.getVisibility() == GONE || isClosing) {
			mFanView.setVisibility(VISIBLE);
			mTintView.setVisibility(VISIBLE);
 
			openAnimation = new FanAnimation(0, px, TypedValue.applyDimension(
					TypedValue.COMPLEX_UNIT_DIP, -20, getResources()
							.getDisplayMetrics()), 0, animDur);
			openAnimation.setFillAfter(true);
 
			if (fade) {
				alphaAnimation = new AlphaAnimation(0.8f, 0.0f);
				alphaAnimation.setDuration((int) 0.75 * animDur);
				alphaAnimation.setFillAfter(true);
				mTintView.startAnimation(alphaAnimation);
			} else { 
				mTintView.setVisibility(GONE);
			} 
 
			mMainView.startAnimation(openAnimation);
			isClosing = false;
		} else if (!isClosing && isOpen()) {
			closeAnimation = new FanAnimation(px, 0, 0,
					TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -20,
							getResources().getDisplayMetrics()), animDur);
			closeAnimation.setFillAfter(true);
			closeAnimation.setAnimationListener(new AnimationListener() {
 
				public void onAnimationStart(Animation animation) {
				} 
 
				public void onAnimationRepeat(Animation animation) {
				} 
 
				public void onAnimationEnd(Animation animation) {
					mFanView.setVisibility(GONE);
					mTintView.setVisibility(GONE);
					isClosing = false;
				} 
			}); 
 
			if (fade) {
				alphaAnimation = new AlphaAnimation(0.0f, 0.8f);
				alphaAnimation.setDuration(750);
				alphaAnimation.setFillAfter(true);
				mTintView.startAnimation(alphaAnimation);
			} else { 
				mTintView.setVisibility(GONE);
			} 
			mMainView.startAnimation(closeAnimation);
			isClosing = true;
		} 
	} 
 
	private class FanAnimation extends Animation {
		private LayoutParams mainLayoutParams, fanLayoutParams;
 
		private float mainStartX, mainEndX;
		private float fanStartX, fanEndX;
 
		public FanAnimation(float fromX, float toX, float fanFromX,
				float fanToX, int duration) {
			setDuration(duration);
			mainEndX = toX;
			mainStartX = fromX;
			mainLayoutParams = (LayoutParams) mMainView.getLayoutParams();
 
			fanStartX = fanFromX;
			fanEndX = fanToX;
			fanLayoutParams = (LayoutParams) mFanView.getLayoutParams();
		} 
 
		@Override 
		protected void applyTransformation(float interpolatedTime,
				Transformation t) {