您需要使用weight属性.可以把它想象成让android知道它应该给每个项目的宽度百分比.
你需要为所有3个项目设置宽度为0dip并添加权重属性
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_width="0dip"
android:layout_weight="2" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Place"
android:layout_width="0dip"
android:layout_weight="1" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
android:layout_width="0dip"
android:layout_weight="2" >
玩重量值,你会明白它是如何工作的:)
在此之后,您可以使用gravity属性将文本移动到中心/左侧或右侧.