问题遇到的现象和发生背景
xamarin 安卓里面如何获取 Resources文件下 values string.xml路径
问题相关代码,请勿粘贴截图
运行结果及报错内容
if (dataset!=null)
{
bl = true;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("@sttrings.xml");//路径如何写
XmlNodeList xnlist = xmlDoc.GetElementsByTagName("data");//这个data是固定
foreach (XmlNode node in xnlist)
{
if (node.Attributes != null)
{
if (node.Attributes["xml:space"].Value == "preserve")//这个preserve也是固定的
{
if (node.Attributes["name"].Value == "设置_用户名")//String1是你想要编辑的
{
node.InnerText = "我成功了";//给他赋值就OK了
}
}
}
}
xmlDoc.Save("@sttrings.xml");
}