Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SquareAndroid reorder xml tag #69

Open
zyallday opened this issue Aug 27, 2019 · 2 comments · May be fixed by #70
Open

SquareAndroid reorder xml tag #69

zyallday opened this issue Aug 27, 2019 · 2 comments · May be fixed by #70

Comments

@zyallday
Copy link

code style: SquareAndroid
When I reformat the xml, it change the tags order in xml. But the Square won't do this.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

  <com.xxx.widget.ItemView
      android:id="@+id/first"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_60" />

  <View
      android:id="@+id/divider1"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_0_5"
      android:layout_marginStart="@dimen/dp_25"
      android:background="#eeeeee" />

  <com.xxx.widget.ItemView
      android:id="@+id/second"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_60"
      android:visibility="gone" />

  <View
      android:id="@+id/divider2"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_0_5"
      android:layout_marginStart="@dimen/dp_25"
      android:background="#eeeeee" />

  <com.xxx.widget.ItemView
      android:id="@+id/third"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_60"
      android:visibility="gone" />

</LinearLayout>

After reformat :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

  <View
      android:id="@+id/divider1"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_0_5"
      android:layout_marginStart="@dimen/dp_25"
      android:background="#eeeeee" />

  <View
      android:id="@+id/divider2"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_0_5"
      android:layout_marginStart="@dimen/dp_25"
      android:background="#eeeeee" />

  <com.xxx.widget.ItemView
      android:id="@+id/second"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_60"
      android:visibility="gone" />

  <com.xxx.widget.ItemView
      android:id="@+id/first"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_60" />

  <com.xxx.widget.ItemView
      android:id="@+id/third"
      android:layout_width="match_parent"
      android:layout_height="@dimen/dp_60"
      android:visibility="gone" />

</LinearLayout>
@ppav ppav linked a pull request Sep 4, 2019 that will close this issue
@zhpanvip
Copy link

+1

@zhpanvip
Copy link

zhpanvip commented May 28, 2021

This problem looks like caused by Android Studio. As following steps:

1.Press ctrl + shift + alt + L (MAC: command + shift+ option + L) at the same time .
2.Remove the "Rerange code" from the pop-up option

Then format the XML code,it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants