Android ADT: Moving views mixes up IDs (bug?)

故事扮演 提交于 2019-12-10 14:18:44

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!