xml - How can I limit the width of a button within a TableRow in Android? -
i want have buttons take little width necessary. xml in layout file is:
<tablerow android:id="@+id/tablerow7" android:paddingleft="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content"> <button android:layout_width="40dp" android:layout_height="wrap_content" android:text="@string/button_ok" android:layout_column="0" android:id="@+id/buttonok" /> <button android:layout_width="20dp" android:maxwidth="20dp" android:layout_height="wrap_content" android:text="@string/button_cancel" android:layout_column="1" android:id="@+id/buttoncancel" /> </tablerow>
i have tried "wrap_content" , "fill_parent" layout_width vals, don't help. can see, tried "maxwidth" property, no avail. here's looks like:
so how can restrict width of button "just enough" contain text? want "cancel" button approximately same width "ok" button, or little more necessary contain text.
so how can restrict width of button "just enough" contain text?
ideally, remove (and ok button) table.
the point behind tablelayout
give characteristics reminiscent of html tables, particularly graybeards me overdosed on html tables in pre-css web development of 1990's.
in html table, cells expand fill width of widest cell in column. same thing here -- width of cancel button dictated column, , presume in column dominated bars of bar chart.
from screenshot, thing should in tablelayout
four-row bar chart itself. "edit list" label(?), radio buttons, , ok/cancel buttons should beneath tablelayout
. if want ok , cancel buttons same width, use horizontal linearlayout
them, give them each width of 0dp
, , give them each weight of 1
.
Comments
Post a Comment