Code example for ScrollView

Methods: addViewsetFillViewport, setBackgroundColor, setLayoutParams, setScrollContainer

-1
			RelativeLayout.LayoutParams scrollViewParams = newLayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
			 
			scrollViewParams.addRule(RelativeLayout.ABOVE, socializeActionBar.getId());
			 
			ScrollView scrollView = newScrollView(parent);
			scrollView.setFillViewport(true);
			scrollView.setBackgroundColor(Color.parseColor("#00000000"));
			scrollView.setScrollContainer(false);
			scrollView.setLayoutParams(scrollViewParams);
			scrollView.addView(original);
			 
			contentView = scrollView;
		} 
		else { 
			ViewGroup.LayoutParams originalParams = original.getLayoutParams();
			LayoutParams updatedOriginalParams = null;
			 
			if(originalParams != null) {
				updatedOriginalParams = newLayoutParams(originalParams);
			} 
			else { 
				updatedOriginalParams = newLayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
			} 
			 
			updatedOriginalParams.addRule(RelativeLayout.ABOVE, socializeActionBar.getId());
			 
			original.setLayoutParams(updatedOriginalParams);
			 
			contentView = original;
		}		 
 
		parentRelLyout.addView(contentView);
		parentRelLyout.addView(socializeActionBar);
		 
		return parentRelLyout;
	} 
	 
	protected LayoutParams newLayoutParams(int width, int height) {
		return new LayoutParams(width, height);
	} 
	 
	protected RelativeLayout.LayoutParams newLayoutParams(android.view.ViewGroup.LayoutParams source) {
		return new RelativeLayout.LayoutParams(source);
	} 
	 
 
	protected RelativeLayout newRelativeLayout(Activity parent) {
		return new RelativeLayout(parent);
	} 
 
	protected ScrollView newScrollView(Activity parent) {
		return new ScrollView(parent);
	} 
 
	protected ActionBarView newActionBarView(Activity parent) {
		return new ActionBarView(parent);
	}