Wierd white line in android start activity - android

When I changed main activity I started getting this wierd line on start activity, how can I show usuall date time, batter and everything you extect to see at top of screen?

You can set statusbar color with theme.
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorSecondary</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:statusBarColor">#color/colorPrimary</item>
</style>
</resources>
Please check your theme in xml file.

I made stupid mistake and added attribute of noactionbar in manifest

Related

How can I apply a transparent background to the windowBackground

I have created a simple image using Inkscape with a transparent background, alpha(0) and at the center, I have a small logo. I then applied it to my styles like below:
<style name="SplashScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">#drawable/splashscreen</item>
<item name="colorPrimary">#android:color/transparent</item>
<item name="colorPrimaryDark">#color/colorPrimary</item>
<item name="colorAccent">#color/loginHeaderBackground</item>
</style>
It works fine, however, I'm missing my main objective, its displaying a black screen with the middle icon instead of a transparent one.
What I want (User should be able to still see their phone background when the app starts to launch)
What I'm getting
Why is this?
There is an example for you. I wrote custom theme and i added this theme to my activty. You should add this your splash activity in manifest file.
<activity ...
android:theme="#android:style/Theme.TranslucentTheme"
.../>
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TranslucentTheme" parent="android:Theme.Translucent">
<item name="android:windowBackground">#color/transparent_black</item>
</style>
<color name="transparent_black">#DA000000</color>
</resources>

How to change color of the scroll limit in android studio

I don't know if this is the correct name to design this but I will add an image to show what I want to do.
As you can see, when you are in the scroll limit, something like a colored wave appears. How could I change that color?
You just need to customise the AppTheme as I did:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#android:color/white</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:colorEdgeEffect">#color/colorAccent</item>
</style>
Add your color to the attribute "colorEdgeEffect".
<item name="android:colorEdgeEffect">#color/colorAccent</item>
And your problem will be solved
NOTE: This will only work for API 21 and above

Custom button style shown in GUI preview, but not in actual app

styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:buttonStyle">#style/button_style</item>
</style>
<style name="button_style" parent="#android:style/Widget.Button">
<item name="android:background">#drawable/simple_button</item>
</style>
</resources>
And I've verified that simple_button works - if I manually assign it to a button's background, it shows up in the app.
Do you have only one styles.xml file? Check this.
Generally has a number of styles.xml files. (ex> values/styles.xml, values-v21/styles.xml, etc...) and Check your device information.
Try using
<item name="buttonStyle">#style/button_style</item>
instead of:
<item name="android:buttonStyle">#style/button_style</item>

Status Bar color not appied to api-21

Hi all I want to change the status bar color, But Mu status bar color is showing black. I tried to search for this I got couple of question about this on stackOverflow but it does not help me. Still on api-21 it shows me black color.
Following is my color.xml inside values-v21
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primaryColor">#3F51B5</color>
<color name="primaryColorDark">#FFA000</color>
<color name="accentColor">#F44336</color>
my style.xml inside values-v21
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
<item name="android:colorPrimary">#color/primaryColor</item>
<item name="android:colorPrimaryDark">#color/primaryColorDark</item>
<item name="android:colorAccent">#color/accentColor</item>
</style>
and my style.xml is like:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#color/primaryColor</item>
<item name="colorPrimaryDark">#color/primaryColorDark</item>
<item name="colorAccent">#color/accentColor</item>
</style>
As one answer suggest therefore I also tried to add following line before setContentView(R.layout.main) as
getWindow.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
but here i did got error in this line as getWindows can not resolve symbol
Hey i guess you missed something typo error 'getWindow' to 'getWindow()'
:-
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
As a sanity check, are you testing on lollipop? even if your using SDK 21 and AppCompat, it will only show on lollipop devices.
Assuming you are testing on lollipop, the next thing I would check is that the theme is being applied to your activity (or set as the default theme) in your AndroidManifest.xml

android: How to change ListPreference title colour?

I would like to change the title and line color of my ListPreference from blue to pink, to match the line of my action bar.
Any ideas? Thanks in advance!
I've been looking through Android's themes.xml and styles.xml looking at things like dialogPreferenceStyle, but haven't figured it out yet.
Had the same problem today.
Old thread, but I found this: and it works perfectly.
Simply modify your styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<!-- Add this -->
<item name="android:dialogTheme">#style/DialogStyle</item>
<item name="android:alertDialogTheme">#style/DialogStyle</item>
</style>
<!-- Customize your color here -->
<style name="DialogStyle" parent="android:Theme.Material.Dialog">
<item name="android:colorAccent">#color/colorAccent</item>
</style>
Ended up creating a custom ListPreference widget, following this answer.
I hoped to be able to simply change the style without having to implement a custom widget, but I haven't figured that out yet.

Categories

Resources