android - 更改 Android UI 表库中的背景(thiagolocatelli)

标签 android listview

我正在尝试找到一种方法来更改 Android 库的背景,例如: 1.排深灰色; 2.排灰色; 3.排深灰色; 4.排灰等

但是没有用。

我试过:

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

在库 UITableView Activity 中,但它不工作。

有人可以帮我吗?

这是图书馆: https://github.com/thiagolocatelli/android-uitableview

我希望 ListView 看起来像这样: http://i.stack.imgur.com/Ls5bG.png

最佳答案

事实上 viewsContainer.setBackgroundColor(R.color.grey); 什么都不做。

你应该像这样更正它:

 viewsContainer.setBackgroundColor(getResources().getColor(R.color.grey));

关于android - 更改 Android UI 表库中的背景(thiagolocatelli),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10287916/

相关文章:

android - 适配器第一个位置 = 第 6 个位置?

android - 将ImageView与布局android的右侧对齐

java - 如果用户不允许在 Android 中获取 map 精确位置的权限,则添加默认位置

Android如何在点击时使 View 突出显示?

java - 如何检查数据更新后ListView是否发生变化

android - 在选项卡式 Activity 中将 sqlite 数据库中的所有数据显示到 ListView 中

android - 在 ListView 中下载图像

Android 4.1 至 4.4 KitKat - 为 API 启用 TLS 1.2

android - [android 并排相机

android - 我可以在 Listview 项目中添加 GridView 吗?