Change background in Android UI table library (thiagolocatelli)

I am trying to find a way to change the background in the Android library, for example: 1.row darkgrey; 2. gray gray; 3. row darkgrey; 4. gray, etc.

But that did not work.

I tried:

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); } 

The UITableView library is working, but not working.

Can 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

+6
source share
3 answers

You can create your own view, and then apply the background color that each line requires, and then add it as a custom view. If you need different colors for odd / even lines, this is the best approach right now. I am going to update this library, there will be a function returning uitableview child elements so that you can iterate between them and set the background color for each row.

+2
source

Actually viewsContainer.setBackgroundColor(R.color.grey); doing nothing.

You should fix it as follows:

  viewsContainer.setBackgroundColor(getResources().getColor(R.color.grey)); 
+2
source

I need to try this.

 itemContainer.setBackgroundColor(Color.GRAY); 
0
source

Source: https://habr.com/ru/post/913981/


All Articles