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 Adding Data for the List

Carl Taggett
Carl Taggett
10,319 Points

Android Button? Question Help Build a Blog Reader Android

Now add the android:layout_width and android:layout_height attributes and set both equal to the value that shrinks the Button around its content (the text on the Button, in this case).

<Button android:layout_width="wrap_content" android:layout_hight="wrap_content"/>

What and I missing or doing wrong?

3 Answers

Paul Stevens
Paul Stevens
4,125 Points

Hello,

Can you paste the code you are trying at the moment, and also which video does this challenge come after?

I'm not sure but you may be looking for something like:

android:layout_width="wrap_content"
android:layout_height="wrap_content"

These will cause the item (your button) to only be large enough to display the content (the text on the button).

Paul :)

Paul Stevens
Paul Stevens
4,125 Points

For the first question I put:

<Button

/>

Then for question 2 I put this inside:

android:layout_width="wrap_content"
android:layout_height="wrap_content" 

So the code for both questions so far looks like:

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

Hope this helps, Paul :)

Carl Taggett
Carl Taggett
10,319 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" tools:context=".MainActivity" >

  <Button>

android:layout_width="wrap_content" android:layout_height="wrap_content" </Button> </RelativeLayout>

The video is "Handling Lack of Data" second question. First question ask to put a button on there