Getting the Listview default clicked color, depending on the Device

余生长醉 提交于 2020-01-30 05:30:09

问题


In my android application, I use a listview and some linear layout on wich the user can click.

Of course, I had to set the background of my LinearLayout to a xml file where the stated pressed, selected are defined:

 myView.setBackgroundDrawable(
 getDrawable(android.R.drawable.list_selector_background));

So no problem I set the drawable to transparent when normal use and orange when clicked.

My only problem is that on the galaxy S and some other customized phone (Sense UI) the color of the listview clicked is blue or green!

So I need to pick this color to set it to the background of my linearlayout. I don't want to mix orange and blue, or orange and green for my user!

Where can I get this color??? That woule be really helpfull!


回答1:


Just found the answer:

android:background="@android:drawable/list_selector_background"


来源:https://stackoverflow.com/questions/3817662/getting-the-listview-default-clicked-color-depending-on-the-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!