lewisjdeane / L-Dialogs

A small library replicating the new dialogs in android L.
567 stars 100 forks source link

How to change ListDialogs selected color? #15

Closed SingleCycleKing closed 10 years ago

SingleCycleKing commented 10 years ago

Could you please tell me how to change the L-ListDialgs selected color?

lewisjdeane commented 10 years ago

I'm slightly confused as to the need of this, since when you click an item it dismisses it, could you elaborate it a bit more so I can understand exactly what you want it to do, cheers.

ChrisMCMine commented 10 years ago

@lewisjdeane I think he is talking about this: alt text

@SingleCycleKing With the latest version of the L-Dialog you can do something like here:

StateListDrawable selector = new StateListDrawable();
selector.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(R.color.color1));
selector.addState(new int[]{-android.R.attr.state_pressed}, new ColorDrawable(R.color.color2));

// The important part:
dialog.getListView().setSelector(selector);
lewisjdeane commented 10 years ago

Oh right I see, a selector, I'll add that later, cheers.

SingleCycleKing commented 10 years ago

Thank you, it's really a good work.