How to change DatePicker dialog color for Android 5.0

The reason why Neil’s suggestion results in a fullscreen DatePicker is the choice of parent theme: <!– Theme.AppCompat.Light is not a dialog theme –> <style name=”DialogTheme” parent=”**Theme.AppCompat.Light**”> <item name=”colorAccent”>@color/blue_500</item> </style> Moreover, if you go this route, you have to specify the theme while creating the DatePickerDialog: // R.style.DialogTheme new DatePickerDialog(MainActivity.this, R.style.DialogTheme, new DatePickerDialog.OnDateSetListener() { @Override … Read more

Is it possible to have two background colors for a single html element? [duplicate]

Simply use linear-gradient as background and you can easily adjust the direction, colors, % of each color: body { margin: 0; background: linear-gradient(to right, red 50%, blue 0%); height:100vh; text-align:center; color:#fff; } some content body { margin: 0; background: linear-gradient(to bottom, red 60%, blue 0%); height:100vh; text-align:center; color:#fff; } some content Or with pseudo-element and … Read more

Background color of text in SVG

No this is not possible, SVG elements do not have background-… presentation attributes. To simulate this effect you could draw a rectangle behind the text attribute with fill=”green” or something similar (filters). Using JavaScript you could do the following: var ctx = document.getElementById(“the-svg”), textElm = ctx.getElementById(“the-text”), SVGRect = textElm.getBBox(); var rect = document.createElementNS(“http://www.w3.org/2000/svg”, “rect”); rect.setAttribute(“x”, … Read more

Animate change of view background color on Android

You can use new Property Animation Api for color animation: int colorFrom = getResources().getColor(R.color.red); int colorTo = getResources().getColor(R.color.blue); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.setDuration(250); // milliseconds colorAnimation.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { textView.setBackgroundColor((int) animator.getAnimatedValue()); } }); colorAnimation.start(); For backward compatibility with Android 2.x use Nine Old Androids library from Jake … Read more