android RelativeLayout,等间距?

kle*_*ver 11 android android-relativelayout

我正在使用相对布局创建一个计算器屏幕,我有一排标记为1,2和3的按钮.我希望它们均匀分布,但我不知道如何使用相对布局

我习惯在LinearLayout中使用android:layout_weight函数,并给它们每个值一个android:layout_width ="fill_parent",以及layout_weight ="1"

任何方式在计算器屏幕上发生这种情况(不指定DP或PX)

这就是我现在设置的内容,它们在TextView(计算器输出屏幕)下按从左到右的顺序排列.任何建议/解决方案均匀空间,填充屏幕的宽度?

    <TextView
android:id="@+id/textView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/edit_text"
android:layout_margin="6px"
/>

<Button
android:id="@+id/button1"
android:text="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
/>

<Button
android:id="@+id/button2"
android:text="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_toRightOf="@+id/button1"/>

<Button
android:id="@+id/button3"
android:text="3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_toRightOf="@+id/button2"
/>
Run Code Online (Sandbox Code Playgroud)

Com*_*are 18

如果你想要相等的间距,你不需要一个RelativeLayout.LinearLayout如您在问题中所建议的那样使用a .如果需要的话,把Buttons一个LinearLayout并把LinearLayoutRelativeLayout.