可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Is there any way to auto complete in XML files in Android studio? Eg: When I start typing RelativeLayout, I want Android studio to recognize it and give me a bare-bones prototype that I can just fill in. Is there any way to enable this?
I checked other answers and my power save mode is off and I'm not using any external libraries.
回答1:
I finally notice it was only the current XML file I was working on which had the issue, and inside a relative layout that have been defined from the WYSWYG editor. Don't know why exactly, rewrite it and everything fine again.
回答2:
You can try File -> Invalidate Cache/Restart. That did it for me.
回答3:
If you cannot use autocomplete in any xml, the working solution is here.
However, if the problem is only with some xml files, you may have used custom views in them, where autocomplete will not work. The workaround is to temporarily change your custom view's name to its original android view and use autocomplete inside, and then revert the view to its custom name.
回答4:
You can check these from preferences.
Settings(Preferences in mac)->Editor->Code Completion
Please double check power safe mode too. it should be off