【问题标题】:Design tag order change in android studio while Rearrange/Reformat(command+ALT+L) the code [duplicate]在重新排列/重新格式化(command+ALT+L)代码时在android studio中设计标签顺序更改[重复]
【发布时间】:2019-08-21 07:03:14
【问题描述】:

在更新我的 android studio 之前,我的代码看起来像这样,重新排列/重新格式化(command+ALT+L)代码

许多用户在这里报告了这个问题

https://issuetracker.google.com/issues?q=Ctrl%2BAlt%2BL

https://issuetracker.google.com/issues/139769915

重新格式化代码的捷径

Windows:Ctrl + Alt + L

Linux:Ctrl + Shift + Alt + L

macOS:Option + Command + L

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:fitsSystemWindows="true"
    tools:context=".view.activity.UserFollowingActivity">

    <data>

        <variable
            name="viewModel"
            type="com.socket.chat.viewmodel.ConversionListVM" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

但是在更新 android studio 之后,我的代码顺序发生了变化,同时重新排列/重新格式化(command+ALT+L)代码

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:fitsSystemWindows="true"
    tools:context=".view.activity.UserFollowingActivity">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </androidx.constraintlayout.widget.ConstraintLayout>

    <data>

        <variable
            name="viewModel"
            type="com.socket.chat.viewmodel.ConversionListVM" />
    </data>
</layout>

在每个设计 XML 文件和 AndroidManifest.xml 文件中都进行了更改。

那么如何用旧方法做到这一点?

【问题讨论】:

  • 我遇到了和你@Mayur 完全相同的问题。我通过转到 Preferences > Editor > Code Style > XML > Tab: Arrangement > Additional settings: Force rerange: Never 来修复。

标签: android android-studio android-layout


【解决方案1】:

只需在首选项 > 代码样式 > XML 中更改此设置即可。 希望能帮助到你。 这是最新的 3.5 更新中的一个错误。

Tap here to see setting image

【讨论】:

  • 和你提到的一样
猜你喜欢
  • 2020-01-01
  • 2021-05-31
  • 1970-01-01
  • 2016-11-04
  • 2019-03-30
  • 1970-01-01
  • 2020-06-17
  • 2011-12-30
  • 2023-03-14
相关资源
最近更新 更多