In my layout there is an AdView. When I choose Dark Theme with background color as black (#292929) in offline mode, there is a black blank space at the place of AdView. AdView shouldn't be there unless there is internet connection. So, my text is covered by that blank space. But if I don't assign any background color, everything is okay. Now, how can I remove this blank black space due to AdView when background color is black?
<style name="AppTheme.Dark" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:background">#292929</item>
<item name="android:textColor">#FFFFFF</item>
</style>
Additional problem: during black background color, when I use magnify glass whole screen becomes black
I have figured out the solution. I should delete it now but might be helpful for others. Instead of choosing background, windowBackground color code solve the problem.
<item name="android:windowBackground">#android:color/black</item>
Related
I'm new to Android studio and I figured out how I can send my application to my phone. The problem is, In the preview, At the bottom, it has this auction bar (See photo) Is there a way to get rid of that? Because my phone (Samsung Galaxy S6 Edge) Does not have that, And it sits in the way if I want to place something at the very bottom. Because in android studio it may be at the very bottom, But on my phone, it isn't.
Also, Is there a way to make that top bar, That is now black, Sort of transparent? So it takes the colour of the background? You see it in a lot of apps. As I mentioned, I'm very new in android studio so sorry.
Thanks in advance
The control bar at the bottom is part of the emulator aka any phone without hard buttons. You can toggle to full screen and it will hide it for you.
For example code simply create new activity and select fullscreen activity. You will see that it manages it by touch of surface to reappear and timer to dissappear. Just remove that bloat and handle it yourself. Done !
As for the status bar at the top, it uses your activity default background. So if you want to change this go to your styles and add a background to your AppTheme and this will be the default background color of unspecified areas instead of black.
Example:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowBackground">#color/blue</item>
<item name="android:actionMenuTextColor">#color/white</item>
</style>
The windowBackground color will drive the background color of unspecified areas unless you override the theme on any particular activity in the manifest. Goodluck.
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);
I am making an app which has a widget, which has a black background. The alpha of the black background can be changed in a widget config screen from transparent to fully opaque black.
My question is about the config activity. Id like to show the widget in the middle of the screen, with its area transparent, so the home screen behind it is visible, so the user can pick which alpha suits it the most. Kind of like the music player Shuttle has it. How can it be done? Can I somehow take a screenshot of the background without all the icons, or do I somehow get a reference to the home screen background?
Thanks a lot!
okay Ive got it, what you need to do is use this in the config theme
<style name="MyWidgetConfigTheme" parent="#style/AppTheme">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowShowWallpaper">true</item>
</style>
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>
In my Android application I need to have a black action bar and my content has a white background. The problem is that whenever I set the actionbar with a black background, all my dropdown spinners and textviews have a white background, and I can't see them together with my white content background. If I set the actionbar to white, the dropdown spinners and textviews have a black background and I can see them properly. I tryed customizing the style from the dropdown spinner with android:dropDownSpinnerStyle But i didn't succeed. How can I solve this?
Edit:
I just solved this issue regarding the Dropdown using the following:
<item name="android:dropDownSpinnerStyle">#style/customDropDownStyle</item>
<style name="customDropDownStyle" parent="#android:style/Widget.Holo.Light.Spinner">
</style>
But I still have this issue regarding an EditText, in which I can't see it's background. I just can't find the attribute I should work with in order to solve the issue.
It was much easier to keep the style of the APP in a way that the dropbox/textfields would be visible, but changing only the style of the Actionbar like that:
<item name="android:actionBarStyle">#style/ActionBar.Light</item>
<item name="android:actionOverflowButtonStyle">#android:style/Widget.Holo.ActionButton.Overflow</item>
<item name="android:actionBarTabStyle">#style/customActionBarTabStyle</item>