[英]What's wrong with Android-Studio imports
Apparently Google no longer supports the Eclipse Android IDE, and I've been having some odd problems with imports in Android studio. 显然谷歌不再支持Eclipse Android IDE,而且我在Android工作室的导入方面遇到了一些奇怪的问题。 When I pasted a code snipped with
ContextMenu menu
, it wouldn't import it, even with alt+enter it would not show the appropriate android.view.ContextMenu
. 当我粘贴使用
ContextMenu menu
剪切的代码时,它不会导入它,即使使用alt +输入它也不会显示相应的android.view.ContextMenu
。
Now I pasted an example with LAYOUT_INFLATER_SERVICE
, and unfortunately it won't recognize it at all - alt+enter suggests creating a constant, class, field, or renaming. 现在我用
LAYOUT_INFLATER_SERVICE
粘贴了一个例子,不幸的是它根本无法识别它 - alt + enter表示创建一个常量,类,字段或重命名。 I don't remember having this problem in Eclipse. 我不记得在Eclipse中遇到这个问题。
Where do I find these constants, or more importantly, how do I get Android-studio to get the right imports without memorizing where these classes/constants are? 我在哪里可以找到这些常量,或者更重要的是,如何在不记忆这些类/常量的位置的情况下让Android-studio获得正确的导入?
What's wrong with Android-Studio imports?
Android-Studio导入有什么问题?
Not much, I'm using it (resp. Intellij Idea) for years now. 并不多,我现在正在使用它(分别是Intellij Idea)。
When I pasted a code snipped with ContextMenu menu, it wouldn't import it, even with alt+enter it would not show the appropriate android.view.ContextMenu.
当我粘贴使用ContextMenu菜单剪切的代码时,它不会导入它,即使使用alt +输入它也不会显示相应的android.view.ContextMenu。
This definitely works for me, so it's certainly not a missing feature. 这绝对适合我,所以它肯定不是缺少的功能。 I would suspect something in your project / module setup being funny.
我怀疑你的项目/模块设置中的某些内容很有趣。 If you're really serious about it I would try to reproduce the issue on a vanilla project.
如果你真的很认真,我会试着在一个香草项目上重现这个问题。
Now I pasted an example with LAYOUT_INFLATER_SERVICE, and unfortunately it won't recognize it at all - alt+enter suggests creating a constant, class, field, or renaming.
现在我用LAYOUT_INFLATER_SERVICE粘贴了一个例子,不幸的是它根本无法识别它 - alt + enter表示创建一个常量,类,字段或重命名。
I can confirm that one. 我可以确认一下。 Annoys me too.
也惹恼了我。 But then: How should the IDE know about a single String matching some constant definition?
但那么:IDE应该如何知道匹配某个常量定义的单个字符串? I would be surprised if Eclipse did any better...
如果Eclipse做得更好,我会感到惊讶......
Try "Symbol-Search" (Ctrl Alt Shift N) or "Search everywhere" (Shift Shift), this should mitigate the problem. 尝试“符号搜索”(Ctrl Alt Shift N)或“随处搜索”(Shift Shift),这可以缓解问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.