问题
I've been having a really annoying problem that I suspect is an Android ADT bug (v21.0.0-519525).
Let's say I'm working on an Activity with two views - a TextView on top and an ImageView on the bottom. I want to move the TextView from the top to the bottom. If I either click or drag it in the GUI, or I cut/paste it in the XML, everything looks fine on the preview and the XML code, but when I go to run the app, their IDs seem to get mixed up. Code which casts R.id.textView to a TextView throws an error because it now thinks that R.id.textView is an ImageView.
Has anyone else run into this? Is there a way around it?
回答1:
That kind of problem sometimes happens when playing around with layout IDs.
One solution is to clean the project and rebuild it.
来源:https://stackoverflow.com/questions/13478052/android-adt-moving-views-mixes-up-ids-bug