Android的ADT:移动的观点混淆了标识(错误?)标识、观点、错误、Android

2023-09-07 23:48:33 作者:死都不愿回到的过去/

我一直有我怀疑是一个Android ADT的bug(v21.0.0-519525)一个非常恼人的问题。

I've been having a really annoying problem that I suspect is an Android ADT bug (v21.0.0-519525).

比方说,我工作的一个活动有两种观点 - 在上面一个TextView和底部的ImageView的。欲TextView的从顶部至底部移动。如果我可以单击或GUI拖动它,或者我剪切/粘贴在XML中,一切看起来在preVIEW和XML code很好,但是当我去运行应用程序,它们的ID似乎以混合起来。 code这蒙上R.id.textView到一个TextView抛出一个错误,因为它现在认为R.id.textView是ImageView的。

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?

推荐答案

这样的问题,布局ID玩耍时,有时会发生。

That kind of problem sometimes happens when playing around with layout IDs.

解决方案之一是清理项目和重建。

One solution is to clean the project and rebuild it.