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 a Blog Reader Android App Rebuilding from Scratch Handling a Lack of Data

Challenge task - problem

Sorry, I have a problem when trying to figure out this challenge task:

"Let’s position this Button in the bottom-right corner of the RelativeLayout (its parent). Remember from the video that we used android:layout_alignParentLeft="true" to pin a TextView the the left side of its parent. Hint: One of the attributes will be layout_alignParentBottom."

Apparently my solution:

<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" >

<Button 
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         />

</RelativeLayout>

isn't correct ?! It gives Hint Bummer! Hint: Use 'android:layout_alignParentRight' to align to the right of the RelativeLayout, and don't forget double quotes around the value!

Thanks....

3 Answers

Stone Preston
Stone Preston
42,016 Points

the hint states: Hint: Use 'android:layout_alignParentRight' to align to the right of the RelativeLayout, and don't forget double quotes around the value!

you forgot to align it right in addition to the bottom

<Button 
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         //these two will align to the bottom right
         android:layout_alignParentBottom="true"
         android:layout_alignParentRight="true"
         />
Andrew West
Andrew West
3,245 Points

It looks like you followed the hint "One of the attributes will be layout_alignParentBottom." just fine. However, there is another step to this problem, the button is supposed to be aligned in the bottom right. You've got the bottom alignment correct. Now you just need to add some right alignment.

The hint you're being given is to use android:layout_alignParentRight in addition to layout_alignParentBottom

Yes, Indeed, actually I thought that android:layout_alignParentBottom="android:layout_alignParentRight" is the correct tag to align on the right side of the bottom. But "true" and "false" are only valid attributes.

Thanks...