Unfortunately, to me this seems like a hack. Is there really no way to force the button not to resize (filling its cell within the table) beyond its needed space?
On Feb 2, 12:51 am, Chander Pechetty <[email protected]> wrote: > <TextView > android:text="please send this" > android:maxWidth="10dip" /> > > If your text requirements are complex, you can use other views below > the image. You can also set the number of lines of text etc. > > On Feb 2, 7:54 am, Pete <[email protected]> wrote: > > > *Scenario* > > I'm attempting to host Image Buttons with a descriptor TextView below > > each button. To do this elegantly, I decided to use a TableLayout. > > > The resulting image should look something like like: > > > [img1] [img2] [img3] > > hi please send this exit > > > As you can see above, each image is properly centered within its cell > > and some text is displayed below. > > > *Issue* > > Unfortunately, if the descriptive text is longer than the ImageButton > > is wide, then the ImageButton associated with that text is stretched. > > See below: > > > [img1] [ img2 ] [img3] > > hi please send this exit > > > *Failed Attempts* > > Setting Height Width: I've already tried to fix this by setting > > layout_width & layout_height for each element, but within a > > TableLayout it does not seem to work (these seem to be ignored for the > > stretched item). > > > Also I thought I could nest each row within a LinearLayout (vertical > > orientation) but for some reason the layout file will not render if an > > ImageButton is nested within a TableLayout > TableRow > LinearLayout. > > > *Example Code* > > You can use this example XML to reproduce the issue at hand. > > > <TableLayout android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:layout_gravity="center_horizontal"> > > > <TableRow android:gravity="center_horizontal" > > android:layout_width="fill_parent"> > > <ImageButton android:id="@+id/button1" > > android:src="@drawable/ > > icon" /> > > <ImageButton android:id="@+id/button1" > > android:src="@drawable/ > > icon" /> > > <ImageButton android:id="@+id/button1" > > android:src="@drawable/ > > icon" /> > > </TableRow> > > > <TableRow android:gravity="center_horizontal" > > android:layout_width="fill_parent"> > > > <TextView android:text="hi" /> > > <TextView android:text="please send this" /> > > <TextView android:text="exit" /> > > </TableRow> > > > </TableLayout> > > > *Question Restated* > > How can I host an ImageButton within a TableLayout (or at least make > > it look like a table layout) without stretching having the TableLayout > > ImageButtons to fit the width of their columns? Most importantly is > > still keeping the text below the ImageButton. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

