Android - Space between TextView and Togglebutton?
android, tablerow, textview, togglebutton
Solution
If you don't want extra space you should set both of their widths to `wrap_content` and wrap them in a LinearLayout:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This Button:"
android:layout_marginLeft="14dp" />
<ToggleButton
android:id="@+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ToggleButton" />
</LinearLayout>
Problem
This is my code: ``` <TableRow android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" > <TextView android:id="@+id/TextView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="This Button:" android:layout_marginLeft="14dp" /> <ToggleButton android:id="@+id/toggleButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="ToggleButton" /> <FrameLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="0.9" > </FrameLayout> </TableRow> ``` When I start my app, it looks like this: ``` This Button: Togglebutton ``` There is a lot of space between the text view and the toggle button.