Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.