Code example for RelativeLayout

Methods: getId, getLayoutParams, setBackgroundColor, setLayoutParams

0
					.getApplicationContext().getSystemService("window");
			 
			//ViewGroup.LayoutParams baseparam1 = battbar.getLayoutParams(); 
			//RelativeLayout.LayoutParams baseparam1a = new RelativeLayout.LayoutParams( 
					//baseparam1); 
			ViewGroup.LayoutParams baseparam = battbar.getLayoutParams();
 
			width = screen.getDefaultDisplay().getWidth();
			height = settingsHeight;
			 
			//baseparam1a.width = ViewGroup.LayoutParams.WRAP_CONTENT; 
			//baseparam1a.height = ViewGroup.LayoutParams.WRAP_CONTENT; 
 
			baseparam.width = (batteryLevel * width) / 100;
			baseparam.height = height;
			 
			battbar.setLayoutParams(baseparam);
			battbar.setBackgroundColor(colour);
			//this.setLayoutParams(baseparam1a); 
			 
			ViewGroup.LayoutParams baseparamc = chargeholder.getLayoutParams();
			Boolean pulse = true;
			// Bullet / Pulse Animation 
			// Leaves artifacts behind.... so true for now. 
			if (pulse) {
				RelativeLayout.LayoutParams align = new RelativeLayout.LayoutParams(
						baseparamc);
				align.height = height;
				align.width = width - ((batteryLevel * width) / 100);
				Log.d("battbar", "" + battbar.getId());
				align.addRule(RelativeLayout.RIGHT_OF, battbar.getId());
				chargeholder.setLayoutParams(align);
				charge.setBackgroundColor(colour);
			} else if (!pulse) {
				RelativeLayout.LayoutParams align = new RelativeLayout.LayoutParams(
						baseparamc);