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 Build an Interactive Story App (Retired) User Input Introducing ImageViews

Sebastian Alegre
Sebastian Alegre
1,747 Points

My image doesnt seem to fit the complete width even though I have removed all of the padding

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity">

<ImageButton
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/titleImageButton"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:src="@drawable/main_title"
    android:adjustViewBounds="true"
    android:contentDescription="Signals from Mars"
    android:scaleType="fitXY" />

</RelativeLayout>

This is something I had difficulty in doing aswell, something I just found easier to do was alter the image. By all account it looks like the image should fit but it doesn't and it doesn't seem to stretch.

2 Answers

You added an ImageButton but it should be an ImageView. That may explain the issue you're having.

you need to switch the imageButtom with image View. also you need to add a altercation = function to make your image fit inside the fortitude of the foreground and background of you biological system equation. then i think your problem will be fixed! yourwelcome