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 trialRaveesh Agarwal
2,994 Pointsandroid:centerInParent="true" please add support for the latest docs
Please add support for this way to do this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white" >
<TextView
android:id="@+id/movieTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="32sp"
android:layout_centerInParent="true"
android:text="" />
</RelativeLayout>
2 Answers
Steve Hunter
57,712 PointsHi Raveesh,
I selected the android:layout_centerHorizontal
property and set that to true
. That passed the challenge. When I tried passing the first task using layout_centerInParent
the error gave the hint to use the first property.
I hope that helps.
Steve.
Raveesh Agarwal
2,994 PointsYes, even I passed the challenge, but instead of writing two lines for centerHorizontal and centerVertical, wouldn't it be wiser to use centerInParent? Are there any known tradeoffs? Thanks a lot for your guidance!
Steve Hunter
57,712 PointsI think that the challenge is just reiterating the topics covered in the previous videos to assist learning, rather than trying to introduce new things, perhaps. The challenge is looking for a property being set that aligns horizontally. It doesn't expressly exclude also being aligned vertically, but that's a reasonable inference. I don't know what the tests behind the scenes are looking for but it seems that the expected output is for vertical alignment not to be altered within task 1.