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

My imageView won't align top like it does in the video...

Here is my XML

<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:src="@mipmap/page0" />

why does it keep displaying right in the middle?

Hi Stephen, we can't see your XML, are you able to paste it in?

<ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:src="@mipmap/page0" />

2 Answers

The ImageView width is set to 'match_parent'. The image will center within the available space, you need to use 'wrap_content'.

android:layout_width="wrap_content"

Changed that and it didn't change anything, the image is still dead center of the design view phone. I'm at a loss as to what to try next. If you have any other idea's I would be more then glad to try.

Stephen

I put in

android:adjustViewBounds="true"

and that did the tick, thanks so much for you help

Stephen