解决方案 »
- Android环境安装时出现:platform 'android-9': tools\aapt.exe is missing.
- 可否实现可以编辑的下拉列表
- 大家知道google有没有语音识别服务的?或者SDK可以调用的?
- 请问:怎样在不同的Activity里传递数据?
- Android创建文本文件的方法问题
- Android内核的简单分析+Android+内核.pdf
- 我只想说三个字,去你的
- 自己做的软件“JustForgetMe 背单词软件” 送分!!!
- android.content.res.Resources$NotFoundException: Resource ID #0x7f080000
- 安卓 绘制图表的问题
- android4.4.4源码编译报错
- 请教懂得切图的大神回答我个问题
if (position % 2 == 0) {//奇偶行背景色
contentView.setBackgroundColor(contentView.getResources().getColor(R.color.palegreen));
}else {
contentView.setBackgroundColor(contentView.getResources().getColor(R.color.lightgreen));
}
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="80dp"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:id="@+id/rl_main"
>
if (arg0 % 2 == 0) {
viewholder.rl_main.setBackgroundColor(R.color.Black);
}else
{
viewholder.rl_main.setBackgroundColor(R.color.White);
}
是需要把焦点获取到item上面。然后再给contentView设置背景。通过position操作contentView就可以了。可以试试,不一定好使。