I'm having troubles designing the menu of an application with XML. What I want to do is to have both ToggleButton
and Button
at same height, but the Button
doesn't appear aligned. It's like if it had something invisible below it that makes it appear a little higher.
I've been looking for info, but I found nothing
Here's the code I wrote on the main.xml:
(...)
<TextView
android:text="Option1:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ToggleButton
android:id="@+id/toggle_option1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100sp"
android:height="50sp" />
<Button
android:id="@+id/button_option1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:height="50sp"
android:text="See"
/>
</LinearLayout>
Any Idea?
Try this:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ToggleButton
android:id="@+id/toggle_option1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100sp"
android:height="50sp"
android:layout_marginBottom="5sp" />
<Button
android:id="@+id/button_option1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:height="50sp"
android:text="See"
android:layout_marginTop="6sp"
/>
</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