Home > Enterprise >  Unable to add values to layout
Unable to add values to layout

Time:10-28

I’m starting my first ever android project on visual studio. Android app (Xamarin) I name the project but whenever I open the layout in resources, the project name appears @string/app_name. Also I notice when I open string.xml values, the strings which include my app name is greyed out. Looks like the layout is unable to recognize values. I think so because I tried adding other values to the layout but none appeared. I’m not sure why this is happening. I’ve been stuck on it for days.

CodePudding user response:

Did you mean when you open the layout.xml in the layout folder, the xml designer will show @string/app_name on the screen's action bar?

I have done a sample to test, when I declare a string in the string.xml and use it in the control I added into the layout.xml, the string will show the real value in the string.xml. But the AppName in the screen's action bar will show as @string/app_name all the time. But when you run it on the emulator or the device, it will show the real value in the string.xml.

So it should be the visual studio android designer's problem. The @string/app_name was used in the attribute: such as [Acticity(Label="@string/app_name")] and the attribute can not get the value from the string.xml at the compilation period but the runtime.

  • Related