I created the program code TextView, now I want to set the text color to TextViewbelow, this is my code
TableLayout ll = (TableLayout) findViewById(R.id.auditContent);
public TableRow row;
TextView txtNumber;
for (int i = 0; i < ItemCount; i++) {
row = new TableRow(MainActivity.this);
TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
row.setLayoutParams(lp);
row.setWeightSum(1f);
txtNumber = new TextView(MainActivity.this);
txtNumber.setGravity(Gravity.CENTER);
txtNumber.setText("No." + count);
txtNumber.setTextColor(getResources().getColor(R.color.blue));
row.addView(txtNumber);
ll.addView(row, i);
}
textcolordoesn’t set the color in the text TextView, t does something wrong, And I am debugging the code, there is no error. Please help thanks
In string.xml
<color name="blue">#33CCCC</color>
m not using color.xml The above color will work fine for xmlTextView
source
share