1

I'm trying to follow this website:

http://developer.android.com/training/basics/firstapp/building-ui.html

and I'm at the bit where it says "Create a Linear Layout":

The BlankActivity template you chose when you created this project includes the activity_my.xml file with a RelativeLayout root view and a TextView child view.

But there is no RelativeLayout or TextView in the activity_my.xml file.

enter image description here

What did I do wrong?

Hussein El Feky
  • 6,627
  • 5
  • 44
  • 57
oshirowanen
  • 15,297
  • 82
  • 198
  • 350

3 Answers3

3

What have I done wrong?

Nothing, other than expecting the documentation to match the tools. Android's documentation is updated infrequently, particularly these tutorials. Usually, there will be discrepancies between the instructions and the tools, though usually not this dramatic. As Stankovitch notes, using "Blank Activity", you would be looking for content_my.xml.

The "Empty Activity" may be a closer match to what you need, as they changed "Blank Activity" a fair bit earlier this year.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
2

The information in the developer website is outdated. The RelativeLayout and TextView is in the content_my.xml file. To know the difference between content_main.xml (or content_my.xml in your case) and activity_main (likewise), follow this link.

Community
  • 1
  • 1
Shoumik
  • 143
  • 1
  • 14
1

Check your content_my.xml file because it was included in your activity_my.xml file. It should probably be there because the preview window in the image you shared indicates that.

Ikechukwu Kalu
  • 1,474
  • 14
  • 15