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


Help with extra credit: Position four ImageViews so they always take up a quarter of the screen

I've been trying to solve this extra credit challenge in Build a Simple Android App > Creating the Screen Layout. It says: "See if you can position four ImageViews so that each one takes up one quarter of the screen no matter how you size it."

After some searching I tried accomplishing this by nesting a LinearLayout within the RelativeLayout and then using the layout_weight property, but I just couldn't get it to work.

Does anyone have any hints or suggestions on how to approach this challenge?

1 Answer

Don't use that RelativeLayout, instead, use a LinearLayout(horizontal) set the weightSum to 1 and inside of that LinearLayout add two LinearLayout(vertical) and in each one of those set the layout:height to "wrap_content",layout:width to "match_parent" and layout:weight to 0.5, i think that you can continue from here, but if you can't feel free to ask

Thanks, this worked for me!

sorry this is super old, but i cant get LinearLayout to stand on it's own without being a child of RelativeLayout. How can i get LinearLayout to stand on it's own?

also when you mention setting layout:height and width, do you mean the image views or the layouts themselves?