我有一个7列15行的表,每个单元格包含一个TextView。我想知道是否有一种方法可以更新单个TextView的内容而无需引用其ID,即可以在表中定位其位置。
我可以使用下面的代码来获取每个单元格的现有值,但是看不到将其修改以更改单元格值的方法。
public static string DownloadGoogleFile(string fileId)
{
Google.Apis.Drive.v3.DriveService service = GetService_v3();
string FolderPath = System.Web.HttpContext.Current.Server.MapPath("/GoogleDriveFiles/");
Google.Apis.Drive.v3.FilesResource.GetRequest request = service.Files.Get(fileId);
string FileName = request.Execute().Name;
string FilePath = System.IO.Path.Combine(FolderPath, FileName);
MemoryStream stream1 = new MemoryStream();
// Add a handler which will be notified on progress changes.
// It will notify on each chunk download and when the
// download is completed or failed.
request.MediaDownloader.ProgressChanged += (Google.Apis.Download.IDownloadProgress progress) =>
{
switch (progress.Status)
{
case DownloadStatus.Downloading:
{
Console.WriteLine(progress.BytesDownloaded);
break;
}
case DownloadStatus.Completed:
{
Console.WriteLine("Download complete.");
SaveStream(stream1, FilePath);
break;
}
case DownloadStatus.Failed:
{
Console.WriteLine("Download failed.");
break;
}
}
};
request.Download(stream1);
return FilePath;
}
答案 0 :(得分:0)
您的函数getCellAtPos返回一个View对象。您只需将其类型转换为TextView对象,因为View没有setText()方法。
TextView tv=(TextView)getCellAtPos(table,pos);
tv.setText("abc");