Discussion:
laying out buttons with transparent backgrounds on a linear layout with a non-transparent background...
phil
2009-08-19 22:36:27 UTC
Permalink
seems pretty straightforward.

<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="92px"
android:padding="0px"
android:horizontalSpacing="0px"
android:background="@drawable/my_background">
<ImageButton android:id="@+id/Button1"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="fill_parent"
android:src="@drawable/button1"
android:background="@+colors/transparent"/>
<ImageButton android:id="@+id/Button2"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="fill_parent"
android:src="@drawable/button2"
android:background="@+colors/transparent"/>
<ImageButton android:id="@+id/Button3"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="fill_parent"
android:src="@drawable/button3"
android:background="@+colors/transparent"/>
</LinearLayout>

But doesn't work! argh...

It scrunches the layout background as the background to each button, I
want it to span all three buttons...

tia.
Mark Murphy
2009-08-19 22:58:04 UTC
Permalink
Post by phil
seems pretty straightforward.
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="92px"
android:padding="0px"
android:horizontalSpacing="0px"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="fill_parent"
</LinearLayout>
But doesn't work! argh...
It scrunches the layout background as the background to each button, I
want it to span all three buttons...
Regarding:

android:background="@+colors/transparent"

You do not want the plus sign, and it is the singular "color":

http://developer.android.com/guide/topics/resources/available-resources.html#colorvals

Try:

android:background="@color/transparent"
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, $35/Year
Loading...