<RelativeLayout android:layout_width="130dp" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="4dp" android:layout_marginLeft="4dp" android:orientation="vertical" > <include android:id="@+id/distance_panel" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" layout="@layout/float_panel_name_low" /> <include android:id="@+id/time_panel" android:layout_below="@id/distance_panel" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" layout="@layout/float_panel_name_low" />
後來查了一下,發現要把layout_width和layout_height也補上才會對,又學了一招。
<RelativeLayout android:layout_width="130dp" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="4dp" android:layout_marginLeft="4dp" android:orientation="vertical" > <include android:id="@+id/distance_panel" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" layout="@layout/float_panel_name_low" /> <include android:id="@+id/time_panel" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/distance_panel" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" layout="@layout/float_panel_name_low" />