如何在android中更改数据表的文本颜色?

如何在android中更改数据表的文本颜色?,android,android-tablelayout,Android,Android Tablelayout,我的问题是:我从XML文件加载一些数据,并将其放入一个名为data Table的自定义类中。 当我在表格布局中打开它时(表格布局包含在滚动视图中),加载的整个文本为浅灰色,难以阅读。 有没有办法改变显示文本的颜色 xml从ftp服务器下载并动态加载到tablelayout中 这是custon类数据表 public class DataTable { private Vector<String> _columnNames; private Vector<Vector<S

我的问题是:我从XML文件加载一些数据,并将其放入一个名为data Table的自定义类中。 当我在表格布局中打开它时(表格布局包含在滚动视图中),加载的整个文本为浅灰色,难以阅读。 有没有办法改变显示文本的颜色

xml从ftp服务器下载并动态加载到tablelayout中

这是custon类数据表

 public class DataTable {

private Vector<String> _columnNames;
private Vector<Vector<String>> _table;
private String _name;

/**
 * 
 */
public DataTable() {
    // TODO Auto-generated constructor stub

    _name = "";

    _columnNames = new Vector<String>(0, 1);
    _table = new Vector<Vector<String>>(0, 1);
}

public void addColumn(String columnName) {
    if (!_columnNames.contains(columnName)) {
        _columnNames.add(columnName);
    }
}

public void addRow() {
    Vector<String> newRow = new Vector<String>(_columnNames.size());
    _table.add(newRow);
}

public void removeRow(int rowIndex) {
    if (rowIndex >= 0 && rowIndex < _table.size()) {
        _table.remove(rowIndex);
    }
}

public String getValue(int rowIndex, int columnIndex) {
    return _table.get(rowIndex).get(columnIndex);
}

public String getValue(int rowIndex, String columnName) {
    return getValue(rowIndex, _columnNames.indexOf(columnName));
}

public void setValue(String value, int rowIndex, int columnIndex) {
    if (rowIndex >= _table.size()) {
        rowIndex = _table.size();
        addRow();
    }

    Vector<String> row = _table.get(rowIndex);
    if (columnIndex >= row.size()) {
        row.add(value);
    } else {
        row.setElementAt(value, columnIndex);
    }
}

public void setValue(String value, int rowIndex, String columnName) {
    addColumn(columnName);
    setValue(value, rowIndex, _columnNames.indexOf(columnName));
}

public int rowCount() {
    return _table.size();
}

public int columnCount() {
    if (_table.size() > 0) {
        return _table.get(0).size();
    } else {
        return 0;
    }
}

public String getName() {
    return _name;
}

public void setName(String tableName) {
    _name = tableName;
}

public String getColumnName(int columnIndex) {
    return _columnNames.get(columnIndex);
}

public Vector<String> getRow(int rowIndex){
    return _table.get(rowIndex);
}
公共类数据表{
私有向量_列名称;
专用向量表;
私有字符串\u名称;
/**
* 
*/
公共数据表(){
//TODO自动生成的构造函数存根
_name=“”;
_columnNames=新向量(0,1);
_表=新向量(0,1);
}
public void addColumn(字符串columnName){
if(!\u columnNames.contains(columnName)){
_columnNames.add(columnName);
}
}
public void addRow(){
Vector newRow=新向量(_columnNames.size());
_表.添加(新行);
}
公共无效删除行(整数行索引){
如果(rowIndex>=0&&rowIndex<\u table.size()){
_表.删除(行索引);
}
}
公共字符串getValue(int-rowIndex、int-columnIndex){
return _table.get(rowIndex).get(columnIndex);
}
公共字符串getValue(int行索引,字符串列名称){
返回getValue(rowIndex,_columnNames.indexOf(columnName));
}
public void setValue(字符串值、int行索引、int列索引){
如果(行索引>=\u table.size()){
行索引=_table.size();
addRow();
}
向量行=_table.get(rowIndex);
如果(columnIndex>=行大小()){
行。添加(值);
}否则{
row.setElementAt(值,columnIndex);
}
}
public void setValue(字符串值、int行索引、字符串列名){
addColumn(columnName);
setValue(值,行索引,_columnNames.indexOf(columnName));
}
公共整数行计数(){
返回_table.size();
}
公共int columnCount(){
如果(_table.size()>0){
return_table.get(0.size();
}否则{
返回0;
}
}
公共字符串getName(){
返回_name;
}
public void setName(字符串tableName){
_名称=表名;
}
公共字符串getColumnName(int columnIndex){
返回_columnNames.get(columnIndex);
}
公共向量getRow(int-rowIndex){
return _table.get(rowIndex);
}
这是XML文件

<newdataset>
   <view>
     <label>Codice Ispezione</label>
       <value>AD3008STIs</value>
   </view>

   <view>
     <label>Città</label>
     <value>Roma</value>
   </view>

   <view>
     <label>Tipologia Report</label>
     <value>Totale copertura ultimo comune</value>
   </view>

   <view>
     <label>Causale Ispezione</label>
     <value>Programmazione sito estesa</value>
   </view>
 </newdataset>

科迪斯伊斯佩齐翁
AD3008STIs
西塔
罗马
蒂波罗吉亚报道
最后通牒
因斯帕齐翁酒店
西托埃斯特萨计划

您是否尝试过设置文本视图(android:textColor)的文本颜色?如果您发布布局文件,我可以提供更多详细信息。我通过手动添加以下行解决了此问题:lblLabel.setTextColor(color.BLACK);其中lblLabel是我动态生成的文本视图,非常感谢。