EclipseAndroid:使4个ImageButtons填充原始屏幕

EclipseAndroid:使4个ImageButtons填充原始屏幕,android,eclipse,imagebutton,Android,Eclipse,Imagebutton,EclipseAndroid:我有4个ImageButtons,我希望在屏幕的向下按钮上有一个相同宽度的raw,用于填充屏幕的宽度。有人能帮我做这件事吗?你可以使用带有weightSum=4的线性布局和水平方向,并将带有权重1的按钮放入此布局中。下面是一个例子 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android

EclipseAndroid:我有4个ImageButtons,我希望在屏幕的向下按钮上有一个相同宽度的raw,用于填充屏幕的宽度。有人能帮我做这件事吗?

你可以使用带有
weightSum=4的线性布局和水平方向,并将带有权重1的按钮放入此布局中。下面是一个例子

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:weightSum="4" >

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
       android:layout_weight="1" />

</LinearLayout>


非常感谢。你能帮助我,如何将它们插入屏幕底部吗?android:layout\u alignParentBottom=“true”在LinearLayout中不起作用!您可以使用RelativeLayout作为LinearLayout的父级,然后使用android:layout\u alignParentBottom=“true”将LinearLayout与底部对齐。非常感谢。在您的帮助下,通过一些更改完全解决了…:)抱歉,还有一个问题,如果我想准确解释的话,我有4个图像按钮,当我使用这些代码时,我们可以看到图像按钮和屏幕两侧之间有一个小空间,有没有办法去掉这个空间?再次感谢。:)我建议你用代码和图片发布另一个问题。