两个或多个按钮水平一起摆放, 让这两个或多个按钮平均的放置,可以让界面看起来跟好看舒服。
下面是两个按钮各占屏幕一半摆放的方法,多个按钮的摆放类似:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<Button
android:id="@+id/scan_button"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Scan..." />
<Button
android:id="@+id/con_button"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Connect" />
</LinearLayout>