Code example for TableRow

Methods: addView

0
		mParsedDataRows = new TableRow[lenresults];
		mFieldLabels = new TextView[lenresults];
		mFieldValues = new TextView[lenresults];
 
		for (int i = 0; i < lenresults; i++) {
			TableRow row = new TableRow(getContext());
			// row.setBackgroundColor(R.color.background_red); 
			// row.setDrawingCacheBackgroundColor(R.color.background_red); 
			// row.setBackgroundResource(android.R.drawable.) 
 
			TextView txvFieldName = new TextView(getContext());
			txvFieldName.setTextSize(14);
			// txvFieldName.setBackgroundColor(R.color.background_red); 
			// txvFieldName.setDrawingCacheBackgroundColor(R.color.background_red); 
			txvFieldName.setGravity(Gravity.LEFT);
			txvFieldName.setPadding(10, 2, 2, 2);
			mFieldLabels[i] = txvFieldName;
 
			TextView txvFieldData = new TextView(getContext());
			txvFieldData.setGravity(Gravity.LEFT);
			txvFieldData.setTextSize(14);
			txvFieldData.setPadding(2, 2, 2, 2);
			// txvFieldData.setBackgroundColor(R.color.background_red); 
			mFieldValues[i] = txvFieldData;
 
			row.addView(txvFieldName, 0);
			row.addView(txvFieldData, 1);
			mParsedDataRows[i] = row;
 
			this.addView(row, new TableRow.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,
														android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
 
		} 
 
		this.setColumnStretchable(0, true);
Experience pair programming with AI  Get Codota for Java