1. 程式人生 > >Eclipse自動調整XML佈局(好看、實用、規範)

Eclipse自動調整XML佈局(好看、實用、規範)

XML佈局格式自動調整:Ctrl+Shift+F

修改設定之前:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/list_selector">
<ImageView android:id="@+id/imageView" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentLeft="true" />
<TextView android:id="@+id/textView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_toRightOf="@+id/imageView" />
</RelativeLayout>

修改設定之後:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/list_selector">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
<TextView
android:id="@+id/textView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/imageView" />
</RelativeLayout>