Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要 ListView 或 GridView 中按下的项目的默认浅蓝色。 view.setBackgroundResource(android.R.drawable.list_selector_background);不起作用。
view.setBackgroundResource(android.R.drawable.list_selector_background);
谢谢你。
You can set the ListSelector drawable in your layout xml:
<ListView ... android:listSelector="#ff0000" />
or by calling:
yourList.setSelector(Color.BLACK);
Use
view.setBackgroundResource(android.R.color.yourcolor);