问题描述
我是 Tizen.NET 的初学者,我想在我的可穿戴应用程序中使用在我的开发机器上创建的图像。我在 Visual Studio 中创建了一个示例 TizenWearable 应用。
我在 shared/res 中保存了一个 circle-cropped.PNG 图像文件
// The root page of your application
MainPage = new ContentPage
{
BackgroundImageSource = "circle-cropped.png",Content = new StackLayout
{
VerticalOptions = Layoutoptions.Center,Children = {
new Label {
HorizontalTextAlignment = TextAlignment.Center,Text = "Welcome to Tizen!"
},button,label,button2
}
}
};
然而,当我运行模拟器进行检查时,我的其他标签和按钮呈现良好,但背景为黑色,没有图像。
如果我运行模拟器 shell,我可以看到我的图像似乎包含在文件系统中:
sh-3.2$ ls
TizenWearableApp1.png circle-cropped.png
sh-3.2$
我哪里出错了?
解决方法
您应该将资源放在 res
文件夹中。
shared/res
文件夹用于与其他应用程序共享资源,不应将私有应用程序资源放在那里。