I have this xml document. I want to have these 93 by 93px button images equally spaced. At the moment the weight setting is making them stretch and hug each other so there are no spaces. But if I set weight to 0 they do the same hugging each other but fill up about half of the screen.
This is for landscape orientation by the way.
<LinearLayout android:id="@+id/LinearLayout" android:layout_height="wrap_content"
android:layout_width="fill_parent">
<Button
android:background="@drawable/a"
android:layout_height="93px"
android:id="@+id/a"
android:layout_width="93px"
android:layout_weight="1"
android:layout_marginLeft="20dip"
android:layout_marginTop="30dip"/>
<Button
android:background="@drawable/b"
android:layout_height="93px"
android:id="@+id/b"
android:layout_width="93px"
android:layout_weight="1"
android:layout_marginTop="30dip"/>
<Button
android:background="@drawable/c"
android:layout_height="93px"
android:id="@+id/c"
android:layout_weight="1"
android:layout_width="93px"
android:layout_marginTop="30dip"/>
<Button
android:background="@drawable/d"
android:layout_height="93px"
android:id="@+id/d"
android:layout_width="93px"
android:layout_weight="1"
android:layout_marginRight="20dip"
android:layout_marginTop="30dip" />
</LinearLayout>
a
LinearLayoutdoes not have an intrinsic notion of “equal spacing”. You might consider using a layout designed for a “dashboard”, such as https://gist.github.com/882650.