hm... i think i'm missing something here. how do i specify layout_width as "the rest of the space that's left"
I have a button of fixed size (or wrap_content) on the left, a textview in the middle, and another button of fixed size on the right. i want to tell the text view that its layout_width should be the space that's left between the two fixed size buttons. not sure how specifying "layout_toRightOf" would help in this scenario... I can get it to work if I hard code the dimensions, but I'd rather do something a little bit more flexible. On Aug 21, 9:12 am, Mark Murphy <[email protected]> wrote: > sdphil wrote: > > i want a button on the left hand side, a button on the right hand side > > and some text centered in the middle -- seems so straightforward! :) > > I never see the button on the right hand side. > > > <LinearLayout android:orientation="horizontal" > > android:layout_centerVertical="true" > > android:layout_width="fill_parent" > > android:layout_height="35px"> > > > <ImageButton android:id="@+id/Btn1" > > android:layout_width="wrap_content" > > android:layout_height="fill_parent" > > android:src="@drawable/btn1" > > android:background="@color/transparent"/> > > > <TextView android:id="@+id/CenteredText" > > style="@style/top_title" > > android:layout_width="fill_parent" > > In the preceding line, you have told Android to have this TextView take > up the whole rest of the row. I suspect that is not what you want, since > that will mean the following ImageButton will not display. > > > android:layout_height="wrap_content" > > android:gravity="center_horizontal" > > android:text="CENTERED TEXT"/> > > > <ImageButton android:id="@+id/Btn2" > > android:layout_width="wrap_content" > > android:layout_height="fill_parent" > > android:src="@drawable/btn2" > > android:background="@color/transparent"/> > > > </LinearLayout> > > Consider using RelativeLayout. It has attributes specifically for your > scenario (attaching items to the left, right, and center of the parent > container). > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Looking for Android opportunities?http://wiki.andmob.org/hado --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

