Android ListView background colors always showing grey.

Posted by fiXedd on Stack Overflow See other posts from Stack Overflow or by fiXedd
Published on 2009-09-09T01:45:25Z Indexed on 2010/04/29 2:37 UTC
Read the original article Hit count: 644

Filed under:
|
|
|

I have a ListView that I'm populating from a custom ListAdapter. Inside the Adapter (in the getView(int, View, ViewGroup) method) I'm setting the background color of the View using setBackgroundColor(int). The problem is that no matter what color I set the background to it always comes out a dark grey. It might also be worth noting that I'm using the Light theme.

Relevant (simplified) bits of code:

AndroidManifest.xml:

<activity 
    android:name=".MyActivity"
    android:theme="@android:style/Theme.Light" />

MyAdapter.java:

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    View av = inflater.inflate(R.layout.my_row, parent, false);
    av.setBackgroundColor(R.color.myRow_red);
    mName = (TextView) av.findViewById(R.id.myRow_name);
    mName.setText("This is a name");
    return av;
}

Any ideas/suggestions?

© Stack Overflow or respective owner

Related posts about android

Related posts about listview