Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Background in Android UI Table Library(thiagolocatelli)

I am trying to find a way to change the background of the Android Library like: 1.row darkgrey; 2. row grey; 3. row darkgrey; 4.row grey etc.

But it did not work.

I tried it with:

 if(mIndexController%2 ==1){
            itemContainer.setBackgroundColor(R.color.grey);
            viewsContainer.setBackgroundColor(R.color.grey);
        }
        else{

            itemContainer.setBackgroundColor(R.color.darkgrey);
            viewsContainer.setBackgroundColor(R.color.darkgrey);
        }

In the Library UITableView Activity, But its not working.

Could someone help me?

Here is the Library: https://github.com/thiagolocatelli/android-uitableview

I want the ListView to look like this: http://i.stack.imgur.com/Ls5bG.png

like image 294
Ahmad Avatar asked Apr 23 '12 20:04

Ahmad


1 Answers

In fact viewsContainer.setBackgroundColor(R.color.grey); does nothing.

You should correct it like this:

 viewsContainer.setBackgroundColor(getResources().getColor(R.color.grey));
like image 123
anticafe Avatar answered Sep 28 '22 01:09

anticafe