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>
Related
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
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.
I'm trying to set my Action Bar color to transparent, so it will have the same color as the background and will also blend in with the gradient background.
I tried doing something like this:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#android:color/transparent</item>
</style>
When I run my app, it launches, loads the screen for one second (all rendered correctly, action bar is transparent), then crashes to the following exception:
java.lang.IllegalArgumentException: background can not be translucent: #0
Tracing to no relevant class of my project.
If I set the parameter to a solid color, everything works fine.
Can you help me with the problem? I couldn't find any solution.
Thanks.
Your app isn't crashing as a result of the ActionBar background being transparent, but as a result of your colorPrimary being transparent, in combination with using the MediaRouter lib.
MediaRouterThemeHelper.getControllerColor and MediaRouterThemeHelper.getButtonTextColor both make calls to ColorUtils.calculateContrast, which is where your IllegalArgumentException is coming from.
ColorUtils.calculateContrast needs a fully opaque color in order to correctly calculate contrast, just based on the formula being used and MediaRouterThemeHelper uses colorPrimary to determine how to theme the MediaRouter controller and button text color.
It looks like you're using a NoActionBar style, so I'm assuming you're using a Toolbar and just setting the background to be your colorPrimary. Instead you could just use #android:color/transparent directly and change your colorPrimary to something opaque.
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);
Noob question for all of you
So I have set up an ImageButton to my app but the problem is the white back ground of my picture clashes with the white default background of the android app. can someone please tell me the default hex color of an android background
There is no "default background" of an Android app. It all depends on the theme of the device.
You have 2 options:
1) Override the background of your app's activity to your own color or drawable. You can do this using the android:windowBackground attribute of your theme. See the docs. Example:
<style name="MyTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:windowBackground">#drawable/grey_background_pattern</item>
</style>
2) You should be using transparent pixels in your image instead of white. This way your image will better fit with the other colors/backgrounds of your app.