获取Listview默认单击颜色,具体取决于设备

Waz*_*_Be 4 android listview default colors device

在我的Android应用程序中,我使用listview和一些用户可以单击的线性布局.

当然,我必须将我的LinearLayout的背景设置为一个xml文件,其中定义了所选的按下,被选中:

 myView.setBackgroundDrawable(
 getDrawable(android.R.drawable.list_selector_background));
Run Code Online (Sandbox Code Playgroud)

所以没问题我在正常使用时将drawable设置为透明,在单击时将其设置为橙色.

我唯一的问题是在Galaxy S和其他一些定制手机(Sense UI)上点击列表视图的颜色是蓝色或绿色!

http://img.skitch.com/20100928-fuq6ie4uxipguxug9yyinwher.jpg 替代文字

所以我需要选择这种颜色将其设置为我的线性布局的背景.我不想为我的用户混合橙色和蓝色,橙色和绿色!

我在哪里可以得到这种颜色?那真的很有帮助!

Waz*_*_Be 6

刚刚找到答案:

android:background="@android:drawable/list_selector_background"
Run Code Online (Sandbox Code Playgroud)