Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Implementing Designs for Android Using Custom Styles and Themes Adding the Cancel Button

Federico Chin
Federico Chin
8,765 Points

Image Divider is not aligning with the two buttons

Hi everyone,

I followed the tutorials to the letter to add the image divider between the two buttons, but the divider is out of place. I tried a couple of different things, but I have not been successful. Thank you for helping me out in this matter.

XML

<ImageView android:id="@+id/buttonDivider" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/button_divider" android:contentDescription="@string/content_desc_button_divider" android:layout_below="@+id/editTextLayout" android:layout_centerHorizontal="true" android:layout_gravity="center"/>

<Button
    android:id="@+id/signupButton"
    android:text="@string/sign_up_button_label"
    android:layout_below="@+id/editTextLayout"
    android:layout_alignParentLeft="true"
    android:layout_toLeftOf="@+id/buttonDivider"
    android:layout_marginRight="0dp"
    style="@style/AuthButton" />


<Button
    android:id="@+id/cancelButton"
    android:text="@string/cancel_button_label"
    android:layout_below="@+id/editTextLayout"
    android:layout_alignParentRight="true"
    android:layout_toRightOf="@+id/buttonDivider"
    android:layout_marginLeft="0dp"
    style="@style/AuthButton" />
Vrezh Gulyan
Vrezh Gulyan
11,161 Points

Can you please post your button divider imageView code? Your buttons seem to be correct.

1 Answer

Adhyan Srivastava
Adhyan Srivastava
5,681 Points

If it still interests you, I think you must be using ImageButton instead of ImageView.I did the same mistake(-: