I want to skin my Android App with multiple Color Themes. This Guides/Tools helped me to generate the basic theme.xml
and style.xml
But i cant figure it out to style the PopupMenu and AlertDialog Header?
I want to change only the Color to streamline with my App Theme!
Example:
to look like
I'm using Theme.Holo
and Android SDK 21.1 RC3/Tools 16.0. I've tried a lot with styles and themes but nothing worked
public class AlertDialogThemed extends AlertDialog {
public AlertDialogThemed(Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Resources resources = getContext().getResources();
final int color = resources.getColor(R.color.dialog_color);
final View title = findViewById(resources.getIdentifier("alertTitle", "id", "android"));
if (title != null) {
((TextView) title).setTextColor(color);
}
final View titleDivider = findViewById(resources.getIdentifier("titleDivider", "id", "android"));
if (titleDivider != null) {
titleDivider.setBackgroundColor(color);
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.