More eclipse madness. Changing the layout file turns TextViews into LinearLayouts

Just changed my layout. xml Everything compiles, and then I got a weird error saying that it cannot use TextView for ImageView. Another change, and I had a strange error saying that I can’t drop ONLY TextView to LinearLayout ??? It turns out, although everything can be compromised, sometimes, if you are not doing a clean project, your TextView widget can just point to RelativeLayout !!! Does anyone know why?

0
source share
1 answer

So here is why:

You may have seen the R.java file in the gen folder.

Open this file.

It contains addresses and memory identifiers for all (R) sources.

When changing layout files, these memory addresses become outdated and point to the wrong view element. A clean / build will delete the R.java file and recreate it and become a necessary step after changing the views.

+2
source

Source: https://habr.com/ru/post/1433496/


All Articles