android - 重新排列/重新格式化(命令+ ALT + L)代码时在android studio中设计标签顺序更改

标签 android android-studio android-layout

<分区>

在更新我的 android studio 之前,我的代码看起来像这样使用 Rearrange/Reformat(command+ALT+L) 代码

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

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

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

Short cut for Reformat the code

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>

It was changed in every design XML file and AndroidManifest.xml file.

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

最佳答案

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

Tap here to see setting image

关于android - 重新排列/重新格式化(命令+ ALT + L)代码时在android studio中设计标签顺序更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57586168/

相关文章:

android - 错误 :Failed to complete Gradle execution. 原因:未知的命令行选项 '-X'

android - 如果没有该屏幕密度的资源,屏幕上会发生什么?

android - 在 Android Studio 中更改字体样式有哪些不同方法

android - 如何通过 kotlin 中的 Intent 传递自定义对象

android - Google Android GCM NotRegistered 错误

firebase - Flutter Firebase 错误(任务 ':app:mergeExtDexDebug' 执行失败)

java - 安卓工作室 : 2 different activities in 1 button

android - 什么是应用链接助手,它与 firebase 应用索引有何不同?

android - 如何高效地将 Android 位图转换为 Leptonica Pix?

android - android中的ontouch : getting X and Y coordinates and drawing circle on that point