列表项的行为选择 [英] List Item Selected Behavior
问题描述
当我改变列表项的背景颜色选择,当它不再闪烁绿色。有没有办法保留这种默认行为当背景改变?
When I change the background color of a list item it no longer flashes green when selected. Is there a way to retain this default behavior when the background is changed?
推荐答案
绿色闪光为背景的一部分。通过更换背景(presumably,用一个简单的颜色),你消除了闪光。
The "green flash" is part of the background. By replacing the background (presumably, with a simple color), you eliminated the flash.
首先,考虑是否应改变列表项的背景。例如,如果你用这种方法做的所有列表项,也许是的ListView
应具备的背景颜色。
First, consider whether you should be changing the background of a list item. For example, if you are doing all of the list items this way, perhaps the ListView
should have the background color.
如果没有帮助,你需要做的背景是 StateListDrawable
通过适当的状态。
If that does not help, you need to make the background be a StateListDrawable
with the appropriate states.
这篇关于列表项的行为选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!