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.
Pablo Gutierrez355 Points
When I hit the Show Another Fun Fact button, i get a screen with a text in vertical saying "Show AnotherFunFact"
Did you Know?
S h o w A n o t h e r F u n F a c t
- That is what I'm seeing, without the button on the screen
In your xml layout file, instead of using what you have for the button:
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Show Another Fun Fact" android:id="@+id/showFactButton" android:layout_alignParentBottom="true" android:layout_alignRight="@+id/factTextView" android:layout_alignEnd="@+id/factTextView" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:background="@android:color/white" />
it should be something like:
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Show Another Fun Fact" android:id="@+id/showFactButton" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@android:color/white" />
Right now, I think the lines "android:layout_alignRight" and "android:layout_alignEnd" being set to "@+id/factTextView" are forcing the button to be the same width as the "factTextView" field, which becomes a single digit number when you press the button. As a result, the button can only be as wide as that number (i.e. one character), and the only way for the button text to fit is for it to display vertically. If you take out that bit, and just have it centered horizontally, it should behave the way you want it to.
I hope this helps!