
I’m trying to remove the blank spaces that it creates automatically before and after the textview. How is it possible?
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/ripetisfondo"
android:padding="1dp" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:text="@string/titolo1"
android:textColor="#FFFFFF"
android:textSize="15dp"
android:textStyle="bold" />
<ToggleButton
android:id="@+id/toggleButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</TableRow>
That screenshot is taken from Eclipse. When I run the app, half toggle button disappears.
Change your textview like so:
This will make the textview expand to fill the available space AFTER everything else is laid out on the screen. Which should let the toggle take the space it needs.
EDIT
You may need to wrap that in a LinearLayout to make it work like I suggested.