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 trialChristopher Stewart
7,531 PointsWhy do the Items in my ListView have a solid white background?
I noticed that in the video the gradient background is visible behind the placeholder items of the ListView. For me each item is on a solid white background. I have to set the text of the TextView to black so that I can see it.
Am I just missing a setting? Setting the ListView's background to #00ffffff didn't do anything, and I don't see a way of setting background color for its items.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context="com.cstewart.stormy.ui.DailyForecastActivity">
<ListView
android:id="@android:id/list"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_data_message"
android:textColor="#ff000000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Christopher Stewart
7,531 PointsThanks. I just added the it to my post.
Christopher Stewart
7,531 PointsLol, nope! That fixed it right up.
1 Answer
Calin Bogdan
14,921 PointsHave you added the gradient drawable to the background attribute?
Calin Bogdan
14,921 PointsCalin Bogdan
14,921 PointsHi!
Could you please paste the ListView layout xml file? It's easier for us to figure out the issue that way. Thanks!