android - Change Blur Background color behind AlertDialog - android

I want to change the black transparent background to white transparent, tried to change it in the AppTheme style but it didn't work.
Also I want to change the black blur background to white blur, tried to change it in the AppTheme style.
I also tried renderscript, fastblur, xml mentioned in this, but it changed only the dialog white background
Any ideas how to change it? Thanks in advance!

Using the style you can change the dim not the blur.
You can use the android:backgroundDimAmount attribute (range: 1.0 - 0.0):
<style name="ThemeOverlay.App.MaterialAlertDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="android:backgroundDimAmount">0.xx</item>
</style>
and
MaterialAlertDialogBuilder(context, R.style.ThemeOverlay_App_MaterialAlertDialog)
.setTitle("Title")
.show()
With 0.10 and 0.90

Related

How to set background color of exposed dropdown PopupWindow?

I'm using an exposed dropdown from material design components. It's an AutoCompleteTextView within a TextInputLayout which basically acts like a spinner. You give it an adapter and it pops up a PopupWindow on click.
The PopupWindow background is a dark gray. I'd like to change it to white. I've tried this via theming to no avail:
<style name="PopupWindow">
<item name="popupMenuBackground">#color/white</item>
<item name="android:popupBackground">#color/white</item>
<item name="android:windowBackground">#color/white</item>
</style>
I've also tried calling this on the AutoCompleteTextView:
autoCompleteTextView.setDropDownBackgroundResource(R.color.white);
This actually worked. However, if I open the dropdown when the keyboard is open, the background turns dark gray again. It's only when the keyboard is dismissed that the background is white.
Any idea how to solve this? Surely there has to be a theme attribute that I can override to make the PopupWindow background white?
Found the solution thanks to this post: https://medium.com/#rmirabelle/there-is-no-material-design-spinner-for-android-3261b7c77da8
Just override colorSurface in your theme:
<item name="colorSurface">#color/white</item>

DialogFragment change shadow(mask) color (NOT dialog content)

I am building a dialog with DialogFragment, and I need to change the color of the shadow (mask), which is transparent and always around the main dialog content. Actually, almost all of the answers on the web is to change the dialog box color, but I need to change the shadow color from transparent black to others. Is there any way to do that?
image:
If you only want to change the alpha for the background then you can easily create a style with android:backgroundDimAmount attribute, like I did
<style name="CustomAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="android:backgroundDimAmount">0.5</item>
</style>
the value ranges 0-1 and then passing the style in your AlertDialog as
AlertDialog dialog = new AlertDialog.Builder(this, R.style.CustomAlertDialogStyle)
.setTitle("Title").setMessage("message").create();
dialog.show();
But if you want to change the background color as well then you can try this work around given by #Lee Han Kyeol
https://stackoverflow.com/a/29482234/5002610
I hope this will solve your issue.

toolbar icon's not totaly white

Lately I have had this problem, which is quite annoying where an icon is not "totally" white, it is in a half gray tone, there are two icons below for a better understanding, I would like the "search" icon to be the same color That of "completed."
You can change colors in one go.
<style name="YourAppTheme" parent="AppTheme">
<item name="android:textColorSecondary">#color/white</item>
</style>
Set color in a theme and Apply that theme to your App. If you already have theme then just add android:textColorSecondary in that theme.
Verify if the icon you are using has some transparency.
If your are using icons from the android SDK icon library then many of them have semi-transparency and the result is some mix between white and the background color.
If you want a fully white icon then you need a not transparent icon.
I deeply appreciate all the help. I was able to solve this using an SVG asset vector.

Change Split Screen Expanding Color Android

When in the Clock app AND in split screen mode AND expanding, the background color of the expanding part is blue like the rest of the app. I'm referring to the part circled in red.
In my app the expanding part color is white, how can I change it to a custom color?
You can do this this by setting the window's background.
In your xml style:
<style name="YourTheme">
<item name="android:windowBackground">#color/your_color</item>
</style>
Or you can do it programmatically:
getWindow().setBackgroundDrawableResource(R.color.your_color);

How to create semi-transparent activity/menu in android

How to achieve a menu similar to this one in the image? How can I display such a menu with semi-transparent background where I can see camera preview. What is the name of that kind of menu?
Set semi transparent or fully transparent color to your layout(menu layout) background.
Below I have mentioned color code with transparency level
Black - "#000000"
100% Transparent"#00000000"
100% Opaque "#FF000000"
50% Transparent "#80000000" (This one you can use in your case)
For more details regarding Android color code you can check
https://stackoverflow.com/a/17239853/1140237
use this code
<style name="MyTheme" parent="android:Theme">
<item name="android:panelFullBackground">{your color or drawable}</item>
</style>

Categories

Resources