String Resource Not Working With Font Tag

Nathan Sokalski 4,111 Reputation points
2023-02-15T03:09:47.5666667+00:00

I have a Xamarin.Android app which contains the following string resource in the strings.xml file:

<string name="ChallengeText"><font fgcolor="@color/IllusionRed">C</font><font fgcolor="@color/IllusionGreen">H</font><font fgcolor="@color/IllusionBlue">A</font><font fgcolor="@color/IllusionYellow">L</font><font fgcolor="@color/IllusionRed">L</font><font fgcolor="@color/IllusionGreen">E</font><font fgcolor="@color/IllusionBlue">N</font><font fgcolor="@color/IllusionYellow">G</font><font fgcolor="@color/IllusionRed">E</font><font fgcolor="@color/IllusionGreen">!</font></string>

But when I attempt to access this resource in a TextView as follows:

android:text="@string/ChallengeText"

Visual Studio 2022 gives the message "This resource URL cannot be resolved". However, if I change the string resource to the following:

<string name="ChallengeText">CHALLENGE!</string>

Everything is fine. I have used the font tag in string resources before with no problem, why can't I use it here?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,448 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 33,561 Reputation points Microsoft External Staff
    2023-02-15T10:01:52.3966667+00:00

    Hello @Nathan Sokalski ,

    Welcome to Microsoft Q&A forum.

    I can reproduce this issue and I have submitted a ticket on our Developer Community, here’s the thread link: This resource URL cannot be resolved. Please kindly follow up that thread, and if there’s any update, I will inform you as soon as possible.

    Thank you for helping us make VS better. Feel free to contact us.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.