1

I have an app which uses list view to show information and I have put sections to divide different types of data. Here is a screenshot how it looks on Android 4.1.2 http://postimg.org/image/ujv765wf1/ It looks the same way on Android 4.0.3 which is just perfect.

But then on Galaxy Nexus, running Android 4.3 the background of the sections disappears and it looks this way http://postimg.org/image/5ik2tayip/

The icons and the other drawable resources are displayed properly, but the only the background is not. The only difference between them is that the background is stated in the XML file and the other resources are added programatically.

Here is the XML file of the section

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:background="@drawable/greenstripe">


        <ImageView
        android:id="@+id/sectionIcon"
        android:layout_width="45dip"
        android:layout_height="37dip"
        android:layout_gravity="center_vertical"
        android:layout_marginLeft="20dip"
        android:contentDescription="@string/emptyString" />

        <TextView android:id="@+id/textViewProject"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_gravity="center_vertical"
        android:textColor="#FFFFFF"
        android:textSize="23sp" 
         />


</LinearLayout>

I guess that if I add the background through code it should work, but I wonder what is the problem here and why the background is not shown on Android 4.3? Thank you in advance.

EDIT: I tried assigning the background from both .png and .xml file, it is still not being shown. ADDITIONALLY I found out that currently this problem occurs only on Galaxy Nexus, when I tested on Galaxy S3 running Android 4.3 it was all fine.

EDIT 2: Now the problem disappeared by itself, I will keep an eye on it and write if something notable happens

Georgi
  • 674
  • 7
  • 21

2 Answers2

0

I have the same issue :

  • a ListView with a white background
  • each child has a View with a gray background and width and height to match_parent within a RelativeLayout

on API 17, everything is OK

on API 18+, the ListView is white

instead of setting a fixed height, I put a min_height to the View, and the problem is (temporary) solved!

hope it helps

0

I think it's a recycling issue of your views. You need to reset your background in your getView() method in your adapter. Copy/paste your adapter code if you want more help.

Aurélien Guillard
  • 1,203
  • 8
  • 20