Code example for TableRow

Methods: getWidthsetBackgroundColorsetLayoutParamsaddView

0
		} 
	} 
	 
	private void AddRow(int position, String textString)
	{ 
		TableRow tr = new TableRow(WTTagActivity.this);
		 
		Resources r = getResources();
		int trHeight = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40 , r.getDisplayMetrics());
		LayoutParams trParams = new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,trHeight);
		tr.setLayoutParams(trParams);
		tr.setBackgroundColor(Color.WHITE);
		 
		 
		final ImageView img = new ImageView(this);
		ClickableText text = new ClickableText(WTTagActivity.this, img, tr);
		text.setBackgroundColor(Color.TRANSPARENT);
		text.setHeight(trHeight);
		text.setWidth(tr.getWidth() - trHeight);
		 
		 
		text.setTextSize(trHeight /3);
		text.setTextColor(Color.BLACK);
		text.setGravity(Gravity.CENTER_VERTICAL);
		 
		 
		text.setText(textString);
		 
		tr.addView(text);
		tagTextList.add(text);
		 
		LayoutParams dummyParams = new LayoutParams(trHeight,trHeight);
		ImageView dummyImg = new ImageView(this);
		dummyImg.setLayoutParams(dummyParams);
		 
		int checkDim = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20 , r.getDisplayMetrics());
		 
		int borderSize = (trHeight - checkDim)/2;
		img.layout(borderSize , borderSize,trHeight - borderSize , trHeight - borderSize);
		 
		RelativeLayout imgL = new RelativeLayout(this);
		imgL.setBackgroundColor(Color.TRANSPARENT);
		imgL.addView(dummyImg);
		imgL.addView(img);
		tr.addView(imgL);
 
		table.addView(tr,position);
	} 
 
	 
Connect your IDE to all the code out there  Get Codota for Java