简体   繁体   中英

Using an image file with a Tizen.NET wearable application (using Visual Studio)

I'm a beginner with Tizen.NET and am wanting to utilise images created on my development machine in my wearable app. I have created a sample TizenWearable app in Visual Studio.

I have saved a circle-cropped.PNG image file in shared/res

在此处输入图像描述

I have added the following code to test using the image as a background image:

    // 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
            }
        }
    };

However when I run the emulator to check, my other labels and buttons render fine, but the background is black, with no image.

在此处输入图像描述

If I run the emulator shell, I can see my image seems to be included on the file system:

sh-3.2$ ls
TizenWearableApp1.png  circle-cropped.png
sh-3.2$

Where am I going wrong here?

You should place your resources in res folder.

The shared/res folder is meant for sharing resources with other applications and private application resources shouldn't be placed there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM