Android Studio 更改 xml 代码样式问题

标签 android xml android-studio coding-style

当我使用 Android Studio 时,它总是会更改我的 XML 代码样式设置。返回它的唯一方法是转到 Preferences->Editor->Code style -> XML 并选择 Scheme as Default。

但我做了很多次。

This question on StackOverflow不符合我的问题。

有人知道怎么解决吗?提前致谢。

最佳答案

我认为您没有提供足够的信息来理解这里的问题所在。但是,我认为,每次从 git 或其他版本控制系统更新代码时,您的 workspace.xml 文件都会重置。如果您使用的是 mac,代码样式或 IDE 的其他配置存储在这里,每次加载程序时,它都会从文件中加载 IDE 配置。

现在这里可以有几种情况。

  • 在提交更改并将更改推送到远程 git 存储库时,您并未提交 workspace.xml 文件中的更改。
  • 您可能之前在 git/remote 存储库中添加了 workspace.xml 文件,然后又在您的 .gitignore 文件中添加了该文件。因此,新修改的 workspace.xml 不再被跟踪,更改也不会提交到远程存储库中。然后每次从远程存储库中提取代码时,您都会得到旧版本的工作区。

如果这是 git 的问题,我建议从远程 git 存储库中删除该文件作为 described here in this answer .

关于Android Studio 更改 xml 代码样式问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57534261/

相关文章:

android - 在 android studio 中禁用运行按钮

android - 为什么我的 android 应用程序的静态变量有时会返回 null?

android - 安卓中的蓝牙

java - Spring ws org.springframework.ws.soap.saaj.SaajSoapEnvelopeException XSD?

安卓错误: AAPT: error: resource color/colorPrimary not found

java - 更改android菜单项的文本

android - 运动布局 : How to Limit the 'OnSwipe' event on a specific view instead of 'OnSwipe' on whole screen

android - Textview 延迟加载,setText 在 gridview 中的错误位置?

java - 在java中转义xml元素名称

java - Android应用程序已停止,无法理解错误日志