<分区>
我在 android studio 中创建了一个简单的布局文件,如下所示:
<?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="match_parent"
android:orientation="horizontal">
<EditText
android:id="@+id/NameEditText"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
当我按下 ALT+CTRL+L(重新格式化)时,android studio 将我的代码更改为:
<?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="match_parent"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/NameEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
您可能已经注意到,按钮的位置已从末尾更改为第一,编辑文本的位置已从代码开头更改为代码结尾!
你能告诉我这种行为是不是错误吗?如果不是错误,如何配置 android studio 使其正常运行?