We have a scroll bar similar to Android Clock App 'Select Cities' activity, but its breaking now that we're making a Marshmallow supported build.
On M it was the wrong size and wrong width. We fixed that with an M-specific theme.
On L it is fine
On K it sits in the middle of the screen and spins, without following the scroll tap target. We guess that we could set a K specific theme too, but not sure how we would get it to follow the scroll bar.
What gives?
If you're using:
<item name="android:fastScrollOverlayPosition">aboveThumb</item>
change it to:
<item name="android:fastScrollOverlayPosition">atThumb</item>
Worked for me. For some reason "aboveThumb" doesn't play nice with pre-L devices.
Related
I made simple tab navigation with content inside. (tested even without navigation just with button in app.compnent.tns.html) and on Android emulator button is hidden under StatusBar however on actual device it is not. I am sure i do not have any global styles applied. Can somebody advice why and what should I do to make it working simmilar?
try android:fitsSystemWindows="false" in xml root layout,
or <item name="android:fitsSystemWindows">true</item> in style.xml
It was due different version of Android (9 and 10) on device and emulator. I solved this by following this: https://github.com/NativeScript/nativescript-angular/issues/2110#issuecomment-576570728
I have an android application which is running on production for several years. Lately, I have discovered a problem with a ListView in the app, that gets blurry while scrolling. The problem only occurs under Android Marshmallow.
Here is a screenshot of the ListView while scrolling
Any help would be much appreciated.
Thanks!
Preface: I posted a separate answer prior to this one, but that solution only worked on my MotoX. I later discovered it did not work for my Galaxy Tab A. The answer here seems to be more universal:
I was able to fix my scrolling blur by defining a separate ListView style for my application and specifying a different list divider. So, for my application theme I set this:
<item name="android:listViewStyle">#style/ListViewStyleNoBlur</item>
Where ListViewStyleNoBlur is defined as:
<style name="ListViewStyleNoBlur" parent="#android:style/Widget.ListView.White">
<item name="android:divider">#android:drawable/divider_horizontal_bright</item>
</style>
I specified these in a values-v23 resources folder so the change doesn't affect pre-Marshmallow devices.
My application theme is based off of android:style/Theme.Light, which is why my list view style's parent is android:style/Widget.ListView.White. My app min SDK is 8, which is why I'm using such an "old" theme. I also noticed that if I use a "newer" theme, such as Holo, the blur does not exist.
I also had this problem and, through trial-and-error, finally found a solution. Hopefully it will also work for you. This appears to be a bug in Marshmallow related to the scroll bar in list views. I had the following property set in my application theme, and removing this property fixed the blurry scrolling:
<item name="android:fadeScrollbars">false</item>
Using true instead of false also works, but is unnecessary since it is the default. I also discovered (through trail-and-error) that using android:fastScrollEnabled="true" causes the same blurring, but based on your scrollbar style, you do not appear to be using it.
In summary, don't use android:fadeScrollbars. If that doesn't fix your issue, try playing around with any other scrollbar-related styles you may be using on your ListView, bearing in mind these styles may be part of the view directly, or part of an activity or application theme.
Background
On Android, you can set an error indication for any EditText view when you want to show the user that what is typed there (or not typed) is wrong (called "form validations").
There is even a nice library for this (here) , and many post here are available of how to use it.
All worked well for me till I've ran it on a nexus 4 with Android 4.2 .
The problem
Sometimes, it just won't show the icons of the errors. In such a case , only when i give the editText (that has the problem) focus, it shows the bubble, but it's empty and doesn't show the icon of the error.
Also, in all cases, the bubbles are always empty.
Why does it occur, and how can I fix it?
Note: I use actionBarSherlock library so I need to use their themes or a theme that is based on theirs.
EDIT:
here are some screenshots:
android 4.2.2 :
android 2.3.5 :
EDIT:
after i thought that this was solved by itself, i've finally figured out when this bug occurs:
if the focus is on another editText which doesn't have an error, and the error of validation is on another editText , the indicator isn't shown till the editText gets focus.
Problem 1: The problem is the Theme of the application.
Try changing the theme to some darker theme like:
<style name="AppBaseTheme" parent="android:Theme.Black">
and it should solve your problem. I found this similar issue earlier and rectified this by changing the theme.
But I didn't research much but I feel that this is Android issue and the bubble should try to change the text colour according to the theme.
Let me know if it solves your problem, or not.
Problem 2: The other issue you are talking about for not taking focus, you may consider the following link: Text Truncating and Focus Issue.
----------------------------------------Updated Answer---------------------------------------------
Q1) What should I add to the theme configuration in order for it to always work, no matter what theme I use?
According to my findings here are some results:
[Note: Only applicable for devices running 3.0 and up]
If your build target is:
less than 11, then using
parent="android:Theme.Light" --> setError() message doesn't work or shows very faded text colour almost blending with color white
parent="android:Theme" --> setError() message works
greater than 11, then using
parent="android:Theme.Holo.Light" --> setError() message works
parent="android:Theme.Holo" --> setError() message works
Since, your project is supported for devices less than 11 API level and you want to support 4.0 and plus too, your best bet would be to go and integrate HoloEverywhere in your project which will solve your problem and you will be able to use your ActionBarSherlock too, for compatibility, check this SO Post.
Q2) What are the available configurations for the error indication UI ?
Mostly you can customise drawables and icons but I doubt you will be able to configure your text and background(If anyone knows more may point out on this)
I would suggest you to check this SO Post for immediate answers.
And for placing the correct focus, for every validation checks, you may place this code:
EditText.setFocusableInTouchMode(true);
EditText.requestFocus();
EditText.setError("My Error Text");
Let me know for any issues.
I recently updated my app, changing it's design a bit. Amongst other things, I styled buttons with custom drawables (well - not exactly custom, just taken from ICS release). Everything works well, except for one of the users.
Instead of:
He sees:
This is a Button, but I have also other controls styled with the same background drawable and the problems appears there (so, it's not limited to buttons).
There are two changed style properties that these controls have in common. One is, of course, a background drawable. The other is textAppearance:
<item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
I came to a conclusion, that this user is using some strange theme, which alters the default value of textAppearance* styles. But I have no idea what attribute may control this "text background color" (android:background does not work, checked this just in case). Or maybe I'm looking in the wrong place and this problem is not related to textAppearance?
EDIT:
The background image is a semi-transparent PNG file.
Android version 2.3.7, Motorola Milestone. That's all I got.
EDIT 2, Fixed:
OK, the problem was at the users side, it turned out he was using CyanogenMod7 with forced 16bit trasparency. After switching that option off, everything works.
OK, the problem was at the users side, it turned out he was using CyanogenMod7 with forced 16bit trasparency. After switching that option off, everything works.
In the new official Twitter app, the scrollbars in all the ListViews the app uses are hidden unless the user is scrolling through the list.
When you start scrolling, the scrollbars appear. When you stop, they fade out with an animation until they are gone completely.
I can't seem to find anything in the documentation that indicates this as being a standard feature.
Is this something included in the API? If not, anyone know how this might be done?
Confirmed : either use android:fadeScrollbars ( if you're API level 5 )
or try to use setOnScrollListener to check scroll status and hide/show the bars . Some code examples are in this thread:
how to detect Android ListView Scrolling stopped?
You can enable scroll bar fading for your entire app on API level 5 and newer via a custom theme and the fadeScrollbars style attribute by adding this to styles.xml:
<style name="Theme.App" parent="android:Theme.Light">
<item name="android:fadeScrollbars">true</item>
</style>
Then set the new theme for your application in AndroidManifest.xml:
<application android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:description="#string/description"
android:theme="#style/Theme.App">
Just be sure you're not overriding this global theme on individual activities. Earlier Android versions will safely ignore this unknown XML attribute and not fade the scrollbars.
I haven't used them yet, but you might play around with android:scrollbarDefaultDelayBeforeFade and android:scrollbarFadeDuration, available on all widgets (i.e., subclasses of View).
I followed Alex's answer and it worked using both the theme settings and through code.
GridView gridview = (GridView) findViewById(R.id.mygridView);
gridview.setScrollbarFadingEnabled(false);
I did encounter a problem however with the Gallery Component. Whilst the following will compile fine, it will throw a NullPointerException. I assume this is to do with a Gallery not having scrollbars to show/hide.
Gallery gallery = (Gallery) findViewById(R.id.myGallery);
gallery.setScrollbarFadingEnabled(false); // <-- this will throw an exception
Android 2.2