Translucent Status Bar on Kitkat, Tinted Status Bar on Lollipop - android

I've searched for a solution, but haven't found one yet.
I'm currently in the process of creating an Android app and my team wants to keep the experience of our app the same across the recent Android versions. We're using the Support v7 library, so most of the Material Design elements can be used in our app, but we're kinda struggling to find a replacement for the tinted status bar. We've got a nice bar on Lollipop, but Kitkat is stuck with the ugly black bar and we'd really like to change that.
We were thinking about a translucent bar for pre-Lollipop devices, but we're not sure on how to approach that. I've tried copying the styles.xml to a new folder, values-v19, and adding
<item name="android:windowTranslucentStatus">true</item>
<item name="android:fitsSystemWindows">true</item>
to the styles, but this is also applied to my phone running Android 5.0.2, strangely enough.
Do you happen to know how to fix this or another method to create a similar effect? I'm new to Android, so detailed explanations will be appreciated.

Try adding
<item name="android:windowTranslucentStatus">false</item>
<item name="android:fitsSystemWindows">false</item>
to either values/styles.xml or values-v21/styles.xml.
When you define a style for a certain API level it will be applied not only to that version, but also to all higher versions, unless explicitly specified otherwise.

Related

Make ListView look the same despite Android version

My application uses a android.support.v7.widget.ListViewCompat and I'm trying to make the "Overscroll" effect look the same on Pre-lollipop and Lollipop.
On pre-lollipop the Overscroll has the Holo-blue color and on Lollipop and above, it uses the colorPrimary attribute.
Most related answers I find on SO are either very complicated (I think this should be a one-liner, preferable in the App theme) or "borks" the default effect on lollipop and looks wierd.
So can can I write to set the overscroll color to colorPrimary on pre-lollipop devices?
My style.xml (App Theme) file currently contains
<item name="colorPrimary">#color/my_green</item>
<item name="colorPrimaryDark">#color/my_forest</item>
<item name="colorAccent">#color/my_soil</item>
<item name="colorControlNormal">#color/my_green</item>
<item name="colorControlActivated">#color/my_forest</item>
<item name="colorControlHighlight">#color/white</item>
I also find it very strange that the colorControlHighlight color is not used when selecting items in the ListView on pre-lollipop but the default holo-orange color.
Glow is taken from R.drawable.overscroll_edge, so I guess you won't be able to replace it easily. It would be easier to replace the EdgeEffect class with custom drawable. See:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/widget/EdgeEffect.java#EdgeEffect
So maybe this is what you're looking for:
Unfortunately this is something really hidden and you won't be able to get that glow without reflection. The above screenshot was taken on Gingerbread, so if you're not afraid of hacks, it's possible. The code is rather long, so I won't paste it here. You can find the implementation in ScrollView and RecyclerView classes of Carbon. There's no ListView (it's now replaced by RecyclerView), but you should be able to get that working as well. It's a copy of Lollipop's glow set as edge effect, so it works and looks like it should.
https://github.com/ZieIony/Carbon/blob/master/carbon/src/main/java/carbon/widget/RecyclerView.java

Allowing views behind the status bar

I know this question was asked already but the answer does not work. I am trying to put an image behind the status bar. I have tried to accomplish this for some time with many different solutions but I am not getting the solution. Doe's anyone know how to make the layout behind the status bar? I have yet to see a solid example. They didn't even use this in their I/O app otherwise, I wouldn't be asking this question.
Targeting api 21 and greater.
Using NoActionBar
<style name="LogInTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>
It looks like you want a transparent status bar.
Add this line to your style:
<item name="android:windowTranslucentStatus">true</item>

Properly set SeekBar style for Holo and pre-Holo APIs

After setting SeekBar with Holo style, I got warning that it's not supported pre-Holo APIs.
If I leave it this way, will this crash the app or pull pre-Holo style anyway? It does not crash on the emulator and I don't have 2.3.3 device.
The reason for asking his is odd behaviour. I tried to manually set style for Holo and pre-Holo using res/values-v11/ directories and placing styles.xml in each and setting the style of SeekBar to style="#style/settings_seekbar" .
Style for API 11+ looked like this
<style name="settings_seekbar">
<item name="android:seekBarStyle">#android:style/Widget.Holo.SeekBar</item>
</style>
and style for APIs older than 11 looked like this
<style name="settings_seekbar">
<item name="android:seekBarStyle">#android:style/Widget.SeekBar</item>
</style>
So it looked like this would work. But on either device with Android 4.0+, I don't see Holo's theme, but the old thick-yellow theme.
If this is the proper way of settings styles (in case the first solution will crash a device), where did I make a mistake thus Holo theme never appeared on newer devices?
It seems we can safely use a theme from the upper SDK because I found no indicators that it will ever crash the app.
If the theme does not exist, Android will use the appropriate lower-level theme.
The error we can see on the image is just a warning that UI will not look the same in the SDKs which do not support this theme.

Blurry text on EditText on SonyEricsson phones - Android

I updated my app for Android 4.0 to make it more futureproof,
after the update, i started to get reports from SE-users that their edittext and textviews are all blurry, the FONT is blurry (which makes me think that this is a SE-problem).
Even if i change the font, it is still blurry.
Does anyone know a solution or have experience the same?
Can't show you any screenshots of this...
Regards.
This is a styling issue.
I had my edit text inherit the Holo theme which caused the text to blur on pre ICS devices, this may be pre HoneyComb, but I haven't been able to check.
values/styles.xml
<!-- Base style for the edit text, api dependant -->
<style name="Widget.EditBase" parent="#android:style/Widget.EditText"></style>
values-v11/styles.xml
<!-- Base Style for the edit text -->
<style name="Widget.EditBase" parent="#android:style/Widget.Holo.EditText"></style>
This fixed it instantly for me - v11 being HoneyComb 3.0 which should be fine as the Holo theme is available from then onwards.
Can't explain why, but assuming it must be with the Widget.Holo.EditText style pointing to the wrong resource pre ICS/HC.
Hope this helps.
Cheers,
Chris
I had this same issue affecting different phones. What my problem was is that my custom theme was using a parent theme from ICS which wasn't available on older phones. My solution was to have a values-v11/themes.xml for ICS devices and values/themes.xml for older android phones.

How do I style the title text in ActionBarSherlock 4.0?

Hello i use ActionBarSherlock Version 4.0.0 and i dont know how to change/style the title text, under version 3.5 i used #style/abTextStyle.
but that doenst work in version 4.0.0.
ABS 4 brought with it some major improvements, one being the styling via XML. If you read the documentation on styling, you would know that as of 4.0 -
Due to limitations in Android's theming system any theme
customizations must be declared in two attributes. The normal
android-prefixed attributes apply the theme to the native action bar
and the unprefixed attributes are for the custom implementation. Since
both theming APIs are exactly the same you need only reference your
customizations twice rather than having to implement them twice.
<style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarStyle">#style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.Styled.ActionBar</item>
</style>
From this we can see that the ABS item reflects the native exactly, obviously without the android prefix.
This in short means that styling the native and ABS actionbar is now much simpler and to do any styling you should follow the standard Android docs on this, and then declare the styling you want like the example above (i.e. declare twice, once for native once for ABS).
This question ActionBar text color has some examples for what you want in its top voted answer, and if you want to be comforted: it was commented on by Jake Wharton who is the genius behind ABS.

Categories

Resources