为$ P $默认的背景颜色的ListView / GridView的pssed项目 [英] Default background color for pressed item in ListView / GridView

查看:124
本文介绍了为$ P $默认的背景颜色的ListView / GridView的pssed项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个选择的GridView控件。所以,我需要为这个默认的颜色(当你点击项目应该保持选中)。我只需要为pressed项目的默认(淡蓝色)的颜色(如列表视图中的蓝色)。

I'm trying to make a selectable GridView. So I need the default color for this (when you click on item it should stay selected). I just need the default (light-blue) color for pressed items (like the blue in listview).

view.setBackgroundResource(android.R.drawable.list_selector_background); 不起作用

感谢您。

推荐答案

我相信这是你在找什么。 一个非常类似的问题已经被问这里。

I believe this is what you're looking for. A very similar question has been asked here.

总之,这应该是你的答案:

In short, this should be your answer:

这是list_selector_holo_dark或等值全息光版本;和
  这些都是蜂窝及以上的默认值。
  list_selector_background是非全息版,姜饼使用
  和下面

It's list_selector_holo_dark or the equivalent holo light version; and these are the defaults in Honeycomb and above. list_selector_background is the non-holo version, used in Gingerbread and below.

要清楚,我引述/ U / Espiandev。

To be clear, I am quoting /u/Espiandev.

这篇关于为$ P $默认的背景颜色的ListView / GridView的pssed项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆