Visual Studio Not Seeing Correct Code

Nathan Sokalski 4,111 Reputation points
2022-02-05T21:59:30.677+00:00

I have a very simple GridLayout which contains android:layout_height="match_parent". The designer displays this perfectly fine, but when I attempt to build or debug the app, I get the following error:

'ma' is incompatible with attribute layout_height (attr) dimension|enum [fill_parent=4294967295, match_parent=4294967295, wrap_content=4294967294].

I have tried all of the following:

Cleaning the app
Rebuilding the app
Changing & resaving the file
Editing the file with Notepad

None of these seem to help. Why is Visual Studio trying to claim that this one attribute of my code is something that it is not?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,366 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nathan Sokalski 4,111 Reputation points
    2022-02-07T16:22:05.117+00:00

    I found the answer. Even though the list of errors claimed the error was in the layout.xml file, the ma was in the include element in activity_main.xml (so I was looking at the wrong file). I think that errors like this related to include elements are sometimes confusing, because they tell you the error is in the wrong file, but I finally found the answer (ma was a typo that should have been match_parent).

    1 person found this answer helpful.
    0 comments No comments

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.