Code example for TableRow

Methods: addView, setLayoutParams, setPadding

0
						Log.d("Info", "Value is: " + value);
					} catch (JSONException e) {
						e.printStackTrace();
					} 
	 
					TableRow row = new TableRow(this);
					row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
							LayoutParams.WRAP_CONTENT));
	 
					TextView textViewForKey = new TextView(this);
					textViewForKey.setText(key + "  ");
					textViewForKey.setTextColor(Color.BLACK);
					textViewForKey.setTextSize(16);
					textViewForKey.setBackgroundColor(Color.parseColor(Constants.BACKGROUND_COLOR));
					textViewForKey.setGravity(Gravity.RIGHT);
					textViewForKey.setTypeface(Typeface.DEFAULT_BOLD);
					 
	 
					TextView textViewForValue = new TextView(this);
					textViewForValue.setText("  " + value);
					textViewForValue.setTextColor(Color.BLACK);
					textViewForValue.setTextSize(16);
					textViewForValue.setBackgroundColor(Color.parseColor(Constants.BACKGROUND_COLOR));
					textViewForValue.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
							LayoutParams.FILL_PARENT, 1f));
	 
					row.addView(textViewForKey);
					row.addView(textViewForValue);
	 
					row.setPadding(2, 2, 2, 2);
	 
					/* Add row to TableLayout. */ 
					TableLayout.LayoutParams layoutParams = new TableLayout.LayoutParams(
							LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
					tl.addView(row, layoutParams);
Connect your IDE to all the code out there  Get Codota for Java