Responsive Ad Area

Share This Post

test

How to get the text color used for buttons on some Android dialogs themes programmaticaly?

I’m using this helper method to get some colors for attributes, for instance using the style ProgressDialog.THEME_DEVICE_DEFAULT_LIGHT like so:

int colors [] = {
  R.attr.color,
  R.attr.colorAccent,
  R.attr.colorBackgroundFloating,
  R.attr.colorButtonNormal,
  R.attr.colorControlActivated,
  R.attr.colorControlHighlight,
  R.attr.colorControlNormal,
  R.attr.colorError,
  R.attr.colorPrimary,
  R.attr.colorPrimaryDark,
  R.attr.actionMenuTextColor,
  R.attr.editTextColor,
  R.attr.subtitleTextColor,
  R.attr.titleTextColor,
  R.attr.textColorAlertDialogListItem
};

for (int i = 0; i < colors.length; i++) {
  int color = ThemeUtils.resolveColor(new ContextThemeWrapper(activity, ProgressDialog.THEME_DEVICE_DEFAULT_LIGHT), colors[i]);
  Log.i("!!!!", String.format("%d %d", i, color));
}

The problem is that all attributes seem to return -65536

I/!!!!: 0 -65536
...
I/!!!!: 14 -65536


How to get the text color used for buttons on some Android dialogs themes programmaticaly?
How to get the text color used for buttons on some Android dialogs themes programmaticaly?
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar