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
Jace Galloway
1,464 PointsAdding an Image troubles
So the crystal ball image stays the same size even when I toggle the width/height for it (the outline around it spreads out but the image stays the same size) and also later in the video when I right click I don't have the Scale Type option. I am on Windows.
Jace Galloway
1,464 Points<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ball01" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textSize="32sp" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:text="Enlighten Me" />
</RelativeLayout>
Ernest Grzybowski
Treehouse Project ReviewerCould you paste the full code? With the layout and all? Thank you!
Jace Galloway
1,464 PointsI can't get it to not cut it off.
Ernest Grzybowski
Treehouse Project ReviewerFixed that for ya.
Jace Galloway
1,464 PointsThank you.
Ernest Grzybowski
Treehouse Project ReviewerOkay, could you now give me the xml you are trying? What values are you inputting when trying to change the height and width?
Jace Galloway
1,464 PointsI don't understand. The video doesn't say anything about changing the XML, Ben just tells us to toggle fill height/width from the Graphical Layout editor. It works for Ben instantly on the video. I'll rewatch again to see if I missed what you are saying.
1 Answer
Ernest Grzybowski
Treehouse Project ReviewerGotcha! I thought you were talking about toggling the height and width manually and to a specific size. I didn't realize that you were talking about the video. Your problem is that you are using an ImageButton and not an ImageView!
There are two things you can do at this point.
- Change the ImageButton to an ImageView in the .xml
or
- Delete the ImageButton in the layout editor and then drag a new ImageView into the layout.
Let me know if you still need help!
Jace Galloway
1,464 PointsThank you, such an easy fix. But this is these sort of thing that really burns proper practice into memory. Thanks again.
Ernest Grzybowski
Treehouse Project ReviewerYes! This is exactly that sort of situation. I'm sure you'll never make that mistake again!
Ben Jakuben
Treehouse Teacher"Learning by struggling" is so valuable! I'm glad Ernest was on here to help (as usual).
Chris Lundberg
820 Pointsgood job,
Ernest Grzybowski
Treehouse Project ReviewerErnest Grzybowski
Treehouse Project ReviewerCan you post your layout code (the xml)?