Code example for View

Methods: getLayoutParamssetLayoutParams

0
		RelativeLayout.LayoutParams barLayoutParams = newLayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
		parentRelLyout.setLayoutParams(barLayoutParams);
		 
		ActionBarView socializeActionBar = newActionBarView(parent);
		socializeActionBar.setActionBarListener(listener);
		socializeActionBar.assignId(original);
		socializeActionBar.setEntity(entity);
		socializeActionBar.setActionBarOptions(options);
		 
		LayoutParams socializeActionBarParams = newLayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
		socializeActionBarParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
		 
		socializeActionBar.setLayoutParams(socializeActionBarParams);
		 
		boolean addScrollView = true;
		 
		if(options != null) {
			addScrollView = options.isAddScrollView();
		} 
		 
		View contentView = null;
		 
		if(addScrollView && !(original instanceof ScrollView) && !(original instanceof ListView) ) {
			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);