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!
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
Aundrea Choe700 Points
I have CustomView rather than Relative Layout under Device Screen
Hi. I currently have Hello World coming out on the screen, but when I am on activity_funfacts.xml, my DeviceScreen has Custom View. My code looks like this:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="practice.funfacts.FunFactsActivity" tools:showIn="@layout/activity_fun_facts">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" />
Daniel Rothmann8,625 Points
In Android Studio 1.5.1 I had to start over and choose an "Empty Activity" when creating the project instead of the "Blank Activity" which seems to have changed in layout and functionality since Ben made the course.
Hey! The contents_funfacts.xml is just used to separate the content(file name says that) from the rest of the layout. You can either use that content_funfacts.xml file and put all the code Ben puts in the other xml file in your content file.
If you don't have that content xml file that's no problem. You can still use the regular xml file. Have a look at the activity xml file and you'll see an include statement that includes the content xml file. So it is just outsourcing the contents of your layout to a different file.
Hope I was able to help!