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

mohamadreza azadi
mohamadreza azadi
5,167 Points

i dont have padding in my xml

hi i'm using android 2.3 and i dont have any padding in my layout

when i see xml code padding is not here (layout)

please help me thanks

1 Answer

Luke Farrell
Luke Farrell
3,278 Points

Hey,

It could be because you are using a Constraint Layout instead of a Relative Layout. Constraint Layout does not support match_parent, so in you image view you can set width to 0dp and start & end constraints to parent.

<ImageView
        android:id="@+id/titleImageView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"
        app:srcCompat="@mipmap/main_title"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"/>

See if that helps.