Welcome to the Treehouse Community
Looking to learn something new?
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!