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
niveditagautam
Courses Plus Student 3,001 PointsWhy isn't my FunFacts android app full screen?
Here is my dimens.xml:
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">0dp</dimen>
<dimen name="activity_vertical_margin">0dp</dimen>
</resources>
Here is the activity_fun_facts.xml:
<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"
android:paddingLeft="50dp"
android:paddingRight="50dp"
android:paddingTop="50dp"
android:paddingBottom="50dp"
tools:context=".FunFactsActivity"
android:background="#ff5cca6b">
<TextView
android:text="Did you know?"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:textColor="#80ffffff"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ants stretch when they wake up in the morning."
android:id="@+id/FactTextView"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:textSize="24sp"
android:textColor="@android:color/white" />
<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:singleLine="false"
android:textSize="18sp"
android:background="@android:color/white" />
</RelativeLayout>
Here is the screenshot:
Update:
Here is the styles.xml file:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.Dialog.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
3 Answers
Niyamat Almass
8,176 PointsI think you should delete
android:paddingLeft="50dp"
android:paddingRight="50dp"
android:paddingTop="50dp"
android:paddingBottom="50dp"
that code in your activity_fun_facts.xml
Hope that help.
Niyamat Almass
8,176 PointsGo to android Manifestfile file and added that
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
and try to run the app. If that doesn't work I think its a emulator problem. You can make a new emulator with Ben Deitch in this workshop http://teamtreehouse.com/library/getting-started-with-the-android-emulator
And run your app in your new emulator.
niveditagautam
Courses Plus Student 3,001 PointsStill no luck!! and it looks the same in my mobile too.
Niyamat Almass
8,176 PointsTry that- Go to dimens.xml and change this
<dimen name="activity_horizontal_margin">0dp</dimen>
<dimen name="activity_vertical_margin">0dp</dimen>
to
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
Niyamat Almass
8,176 PointsJon Kussmann , Steve Hunter , Harry James
Hey guys can you solve this problem?
Steve Hunter
57,712 PointsLet me have a look - just loading the Emulator, so I'll get back to you in about a week. ;-)
Steve Hunter
57,712 PointsIs there a Theme issue here? I've not got a complete version of this app, unfortunately so I can't compare what you have with anything here.
What does the top of your fun_facts_activity file look like? I can't see that you've created a RelativeLayout. I can't see the id for it. Can you post the first few lines of code, please?
Fullscreen stuff is often defined in the theme - perhaps the later SDKs handle this differently than when the course was written.
niveditagautam
Courses Plus Student 3,001 PointsDidn't work :(
There is little margin on top and bottom too..
niveditagautam
Courses Plus Student 3,001 PointsSteve Hunter : Updated the code. Actually it was there, but the code wasn't formatted properly. Do you want me to add something else too??
Steve Hunter
57,712 PointsI'm not sure what the issue is, to be honest - it would be helpful to have a git repository so I can replicate the issue at this end.
One thing, and I genuinely don't know if this makes any difference at all - it probably won't - but shouldn't the RelativeLayout have a line like android:id="@+id/realtiveLayout". I guess that would only matter if the ID was referred to somehwere.
Sorry I can't be much help on this one! It is a strange issue.
Steve.

niveditagautam
Courses Plus Student 3,001 Pointsniveditagautam
Courses Plus Student 3,001 PointsBut that was in the video (https://teamtreehouse.com/library/build-a-simple-android-app-new/creating-the-screen-layout/setting-padding)