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 trialJames N
17,864 Pointsmy daily listview is messed up!
my daily listview code is:
<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
android:paddingLeft="64dp"
android:paddingRight="32dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
tools:background="#ffaa00">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/circleImageView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="@drawable/bg_temperature"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/iconImageView"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/circleImageView"
android:layout_toEndOf="@+id/circleImageView"
android:paddingLeft="10dp"
android:src="@drawable/clear_day"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dayNameLabel"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/iconImageView"
android:layout_toEndOf="@+id/iconImageView"
android:textColor="#ffffffff"
android:textSize="20sp"
android:paddingLeft="10dp"
tools:text="Wednesday"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/temperatureLabel"
android:layout_alignLeft="@+id/circleImageView"
android:layout_alignRight="@+id/circleImageView"
android:gravity="center"
android:textColor="#f25019"
tools:text="100"
android:layout_alignBottom="@+id/circleImageView"
android:layout_alignTop="@+id/iconImageView"
/>
</RelativeLayout>
I have taken a screenshot of what happens, let me know if you want it.
James N
17,864 PointsComing right up!
1 Answer
James N
17,864 PointsMy activity_daily_forecast.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="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="james.stormy.UI.DailyForecastActivity"
android:background="@drawable/bg_gradient">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@android:id/list"
android:layout_alignParentTop="false"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="true"
android:layout_below="@+id/ThisWeekLabel"
android:layout_above="@+id/locationLabel"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:divider="@null"
android:dividerHeight="0dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_daily_forecast_data"
android:id="@android:id/empty"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:textColor="#ffffffff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This Week's Weather"
android:id="@+id/ThisWeekLabel"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="#ffffffff"
android:textSize="30sp"
android:layout_marginTop="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="America/Toronto"
android:id="@+id/locationLabel"
android:layout_centerHorizontal="true"
android:textSize="18sp"
android:textColor="#ffffff"
android:layout_marginBottom="10dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
Izaak Prats
4,149 PointsDid this seem to fix the problem you were having?
James N
17,864 Points??? what did I do to fix the problem ??? you didn't post what I had to do (ROFL)
Izaak Prats
4,149 PointsWell I thought maybe you didn't have your relative layout at all, meaning the layout would just break since it wouldn't have, y'know, a layout. But I see now that it was included. My next suggestion is to post your screenshot and explain what's happening instead of letting us figure out both the problem and the solution.
Izaak Prats
4,149 PointsIzaak Prats
4,149 PointsWhere is your padding/layout elements for your relative layout? On top of that, where is your relative layout that all this is supposed to be in?