I need to get the selection color used by Android to draw ListView and EditText selection. I know these controls user selectors to draw their states, but I've written a few widgets that I want to match the selection color of the platform they are running on and the drawables that are defined can't do that because they are using 9 patch images instead of colors.
I've looked all through the Android source and haven't found a color selector or color constant I can use to get the color I'm looking for.
You could try this :
android:background="?android:attr/selectableItemBackground"
you can get all the resource from here
android-sdk-windows\platforms\android-<Desire API Level>\data\res\drawable-hdpi.
or you can use directly like this
android:background="@android:drawable/list_selector_background"
or like this also
Drawable d = getResources().getDrawable(android.R.drawable.list_selector_background);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With