if I try to align the toggle inbetween two buttons within a LinearLayout, I always come up with something where the toggle is slightly misaligned by about 2px to the bottom. I tried a RelativeLayout and also android:layout_gravity=""center_vertical"
.
Thanx, Huck
I just added android:layout_gravity=""center_vertical" to both controls and the desaligment dissapears. although I am using SDK 2.3.3
Like the guy above said : This works perfectly..
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_gravity="center_vertical" />
<ToggleButton
android:id="@+id/toggleButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ToggleButton"
android:layout_gravity="center_vertical" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_gravity="center_vertical"/>
</LinearLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With