Android TableLayout gravity and padding issue

EngivyEssette

New Member
All right, so I'm working currently on the layout for an activity using a TableLayout and getting the damn table where I want it isn't really working out all that well.Here's a screenshot of what it looks like right now:
tUq71.png
I have three goals at the moment:[*]Have the LinearLayout containing the EditText and ToggleButton centered horizontally in the screen (haven't been able to do that yet either)[*]Have the table layout (the 6 buttons with trig ftns on them) centered horizontally underneath the LL without breaking it into 3 LinearLayouts[*]Getting the buttons to all be the same size without using absolute values aside from margins and padding.Any insight into how I'd do any or all of those above goals would be appreciated as I've basically exhausted my own xml layout knowledge and would prefer to avoid doing it programatically, what I usually do in this kind of situation.For reference, here's the xml for the current layout seen above(the xml version line is there, but it just doesn't want to copy right in this post):\[code\]<com.hinodesoftworks.lordkat.widgets.TitleBar android:id="@+id/calc_titlebar" android:layout_width="match_parent" android:layout_height="wrap_content" /><TextView android:id="@+id/calc_input_label" android:layout_width="wrap_content" android:layout_height="wrap_content" /><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" > <EditText android:id="@+id/calc_input" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/txt_trig_hint" /> <ToggleButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:background="@drawable/button_selector" android:paddingBottom="5dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="5dp" android:textOff="@string/txt_trig_toggle_radians" android:textOn="@string/txt_trig_toggle_degrees" /></LinearLayout><TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:weightSum="3" > <TableRow android:layout_gravity="center_horizontal" android:layout_weight="1" > <Button android:id="@+id/trig_sine_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="2dp" android:layout_marginLeft="5dp" android:layout_marginRight="1dp" android:layout_marginTop="2dp" android:background="@drawable/button_selector" android:paddingBottom="10dp" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="10dp" android:text="@string/txt_trig_sine_button" /> <Button android:id="@+id/trig_secant_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="2dp" android:layout_marginLeft="5dp" android:layout_marginRight="1dp" android:layout_marginTop="2dp" android:background="@drawable/button_selector" android:paddingBottom="10dp" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="10dp" android:text="@string/txt_trig_secant_button" /> </TableRow> <TableRow android:layout_gravity="center_horizontal" android:layout_weight="1" > <Button android:id="@+id/trig_cosine_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="2dp" android:layout_marginLeft="5dp" android:layout_marginRight="1dp" android:layout_marginTop="2dp" android:background="@drawable/button_selector" android:paddingBottom="10dp" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="10dp" android:text="@string/txt_trig_cosine_button" /> <Button android:id="@+id/trig_cosecant_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="2dp" android:layout_marginLeft="5dp" android:layout_marginRight="1dp" android:layout_marginTop="2dp" android:background="@drawable/button_selector" android:paddingBottom="10dp" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="10dp" android:text="@string/txt_trig_cosecant_button" /> </TableRow> <TableRow android:layout_gravity="center_horizontal" android:layout_weight="1" > <Button android:id="@+id/trig_tangent_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="2dp" android:layout_marginLeft="5dp" android:layout_marginRight="1dp" android:layout_marginTop="2dp" android:background="@drawable/button_selector" android:paddingBottom="10dp" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="10dp" android:text="@string/txt_trig_tangent_button" /> <Button android:id="@+id/trig_cotangent_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="2dp" android:layout_marginLeft="5dp" android:layout_marginRight="1dp" android:layout_marginTop="2dp" android:background="@drawable/button_selector" android:paddingBottom="10dp" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="10dp" android:text="@string/txt_trig_cotangent_button" /> </TableRow></TableLayout><TextView android:id="@+id/calc_results_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/txt_trig_results_label" /><TextView android:id="@+id/calc_results" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="123.456" /><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" />\[/code\]
 
Back
Top