Status Update
Comments
ru...@gmail.com <ru...@gmail.com> #2
[Comment deleted]
ci...@gmail.com <ci...@gmail.com> #3
It also happens to me on stock Nexus 7 2012 (4.4.4).
It works fine on any of my other devices: Nexus 5 (5.0), Galaxy Nexus (4.3) and Nexus One (latest Gingerbread).
It works fine on any of my other devices: Nexus 5 (5.0), Galaxy Nexus (4.3) and Nexus One (latest Gingerbread).
al...@android.com <al...@android.com>
an...@gmail.com <an...@gmail.com> #4
Does it happens with dark background? Because I think the drawables used in appcompat have the same color from your screen background.
ho...@gmail.com <ho...@gmail.com> #5
Happens on ActionbarDark also.
Here's a screenshot comparison of a Nexus 7 4.4.2(works) and a Nexus 7 4.2.2(missing thumb)
Here's a screenshot comparison of a Nexus 7 4.4.2(works) and a Nexus 7 4.2.2(missing thumb)
af...@gmail.com <af...@gmail.com> #6
Interestingly, the device I had this issue with (Dell Venue 3830, version 4.4.2) also did not give me issues when I tried to run Lollipop transition methods on it. It just handled them gracefully, found it weird since the Nexus 7 on 4.4.4 couldn't do that but displays the SwitchCompat thumbs properly.
ag...@gmail.com <ag...@gmail.com> #7
I'm having the same problem on a Nexus 7 4.4.4. Unfortunately this bug didn't get fixed in 21.0.2. Did someone figured out a workaround?
ch...@google.com <ch...@google.com> #8
Can you clarify which devices you're seeing this on? Nexus 7 2012 or 2013?
ag...@gmail.com <ag...@gmail.com> #9
I reproduced it on a Nexus 7 2012 with 4.4.4 in Genymotion since I don't have a physical one. But the other users tested it on a real device if I understood them correctly...
tb...@gmail.com <tb...@gmail.com> #10
I see this on my Samsung Galaxy Note 8.1 (GT-N5110) running 4.4.2. I just rebuilt/tested using AppCompat 21.0.2 and my switches look like the first screenshot in comment #5 . On my Nexus 5 at 5.0, everything looks great.
ch...@google.com <ch...@google.com> #11
This sounds like a tvdpi scaling issue.
mw...@googlemail.com <mw...@googlemail.com> #12
I also reproduced it on a Galaxy Pocket Neo, which is an LDPI device.
lo...@gmail.com <lo...@gmail.com> #13
[Comment deleted]
lo...@gmail.com <lo...@gmail.com> #14
/me gets the impression google doesn't care (as usual) and this new widget is therefore useless as it can't be used reliably across all devices. guess it's back to the checkbox for me.
ch...@google.com <ch...@google.com> #15
#14: The source is freely available, feel free to fix it yourself in a local build.
ag...@gmail.com <ag...@gmail.com> #16
I did some further debugging and found out that this line returns an empty Drawable on the affected devices for the thumb (tested with Nexus 7 2012 4.4.4 in Genymotion):
Drawable drawable = ContextCompat.getDrawable(mContext, resId);
see:https://github.com/android/platform_frameworks_support/blob/master/v7/appcompat/src/android/support/v7/internal/widget/TintManager.java#L133
its loading abc_switch_thumb_material.xml which is loading these NinePatch png's:
abc_btn_switch_to_on_mtrl_00001.9.png
abc_btn_switch_to_on_mtrl_00012.9.png
After replacing them with "normal" png's it did work. So I guess the NinePatch png's are not correctly processed.
ContextCompat.getDrawable(mContext, resId) is part of android.support.v4.content.ContextCompat. So I guess this issue is not in appcompat-v7, but in appcompat-v4...
Drawable drawable = ContextCompat.getDrawable(mContext, resId);
see:
its loading abc_switch_thumb_material.xml which is loading these NinePatch png's:
abc_btn_switch_to_on_mtrl_00001.9.png
abc_btn_switch_to_on_mtrl_00012.9.png
After replacing them with "normal" png's it did work. So I guess the NinePatch png's are not correctly processed.
ContextCompat.getDrawable(mContext, resId) is part of android.support.v4.content.ContextCompat. So I guess this issue is not in appcompat-v7, but in appcompat-v4...
ag...@gmail.com <ag...@gmail.com> #17
It really sounds like a scaling issue of NinePatches. I played around with the textures and found out that it's working on the Nexus 7 when you:
- delete the hdpi resources of the thumb
- delete eveything except the mdpi resources
- delete eveything except the xhdpi resources
Its' NOT working when you:
- delete eveything except the hdpi resources
- delete eveything except the xxhdpi resources
- delete eveything except the xxxhdpi resources
It seems like only scaling from mdpi or xhdpi to tvdpi works for the thumb.
A workaround is to add tvdpi resources. But I guess the real problem is deeper...
- delete the hdpi resources of the thumb
- delete eveything except the mdpi resources
- delete eveything except the xhdpi resources
Its' NOT working when you:
- delete eveything except the hdpi resources
- delete eveything except the xxhdpi resources
- delete eveything except the xxxhdpi resources
It seems like only scaling from mdpi or xhdpi to tvdpi works for the thumb.
A workaround is to add tvdpi resources. But I guess the real problem is deeper...
ci...@gmail.com <ci...@gmail.com> #18
This issue is described here:
http://android-developers.blogspot.com/2012/07/getting-your-app-ready-for-jelly-bean.html
"Make sure that any stretchable regions are at least 2x2 pixels in size, else they risk disappearing when scaled down."
All drawables for switch thumb have only 1px regions on the top and left border, so after scaling them down (from hdpi) the 1px regions disapear. AFAIK when stretchable regions are missing in 9.png it is no longer a valid nine patch file and probably loading it results with "null".
So solution should be to update the drawables (and not only for switch thumb!) with at least 2px stretchable regions (according to official recommendation).
"Make sure that any stretchable regions are at least 2x2 pixels in size, else they risk disappearing when scaled down."
All drawables for switch thumb have only 1px regions on the top and left border, so after scaling them down (from hdpi) the 1px regions disapear. AFAIK when stretchable regions are missing in 9.png it is no longer a valid nine patch file and probably loading it results with "null".
So solution should be to update the drawables (and not only for switch thumb!) with at least 2px stretchable regions (according to official recommendation).
ag...@gmail.com <ag...@gmail.com> #19
You are right, increasing the regions to 2x2 pixels did work! Can we expect a bugfix release soon?
But why is scaling down form xhdpi working with 1-pixel regions but not from hdpi?
Anyway, I think the documentation (http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch ) should be changed to include this behaviour as well. The explanation of the layout bounds is missing too....
But why is scaling down form xhdpi working with 1-pixel regions but not from hdpi?
Anyway, I think the documentation (
pe...@gmail.com <pe...@gmail.com> #20
Hello. I'm just thinking how to best workaround this. Did anyone manage to put together a list of fixed resources for the switch? I guess we would just need to add 2px instead of one for the stretchable regions and include them with the app resources?
lo...@gmail.com <lo...@gmail.com> #21
[Comment deleted]
lo...@gmail.com <lo...@gmail.com> #22
> Hello. I'm just thinking how to best workaround this. Did anyone manage to put together a list of fixed resources for the switch? I guess we would just need to add 2px instead of one for the stretchable regions and include them with the app resources?
I have quickly put the fixed resources here:https://github.com/lopespm/quick-fix-switchcompat-resources . The widget seems to still need a few tweaks, as the thumb seems to be misplaced a bit to the top.
I have quickly put the fixed resources here:
lo...@gmail.com <lo...@gmail.com> #23
#22, thnx. now works for me on nexus s, nexus 7.2012 and nexus 5.
please note, that the nexus s and nexus 7.2012 show vertical misalignment of the thumb before and after your updated resources so I don't think it's a problem with your fix. good enough that I can now use SwitchCompat
please note, that the nexus s and nexus 7.2012 show vertical misalignment of the thumb before and after your updated resources so I don't think it's a problem with your fix. good enough that I can now use SwitchCompat
[Deleted User] <[Deleted User]> #24
There's a new support-v4 library v21.0.3 and the bug is still there.
ma...@gmail.com <ma...@gmail.com> #25
#24, Well, SwitchCompat is in support-v7 library, not support-v4.
[Deleted User] <[Deleted User]> #26
Oops, you're right. It's support-v7-appcompat. It's been updated to 21.0.3 and the problem remains.
ch...@google.com <ch...@google.com> #27
Yes, v21.0.3 was a very small hotfix release. This will be in the next large release.
ke...@teslacoilsw.com <ke...@teslacoilsw.com> #28
There's also a related issue that the hdpi abc_switch_track_mtrl_alpha.9.png has uneven stretchable regions, (2px at the top and 1px at the bottom) causing the track to be off center.
su...@gmail.com <su...@gmail.com> #29
I can confirm thumb misalignment on hdpi devices, in v21.0.3
very ugly
very ugly
vi...@gmail.com <vi...@gmail.com> #30
[Comment deleted]
vi...@gmail.com <vi...@gmail.com> #31
Version 22.0.0 does not appear to contain the fix, only checked
abc_btn_switch_to_on_mtrl_00001.9.png
abc_btn_switch_to_on_mtrl_00012.9.png
in the hdpi folder.
abc_btn_switch_to_on_mtrl_00001.9.png
abc_btn_switch_to_on_mtrl_00012.9.png
in the hdpi folder.
ag...@gmail.com <ag...@gmail.com> #32
The issue where the circle wasn't displayed looks fixed to me (tested in emulator running a Nexus 7 2012 with tvdpi). Can you guys confirm its fixed on real devices?
Unfortunately the circle is off center (some pixels too high) and cropped on the right which doesn't look nice (see attachment)
Unfortunately the circle is off center (some pixels too high) and cropped on the right which doesn't look nice (see attachment)
ch...@google.com <ch...@google.com> #33
Released in the v22 support lib.
#31: Look in drawable-tvdpi
#32: There are alignment improvements coming in the next release.
#31: Look in drawable-tvdpi
#32: There are alignment improvements coming in the next release.
ag...@gmail.com <ag...@gmail.com> #34
#33: good to hear :) May I ask for an ETA? *duck*
ch...@google.com <ch...@google.com> #35
#34: Soon, no where near as long as it took to get v22 out.
m....@gmail.com <m....@gmail.com> #36
Was the issue in #32 fixed in version 22.1 released a couple of hours ago?
ta...@gmail.com <ta...@gmail.com> #37
appcompat 22.1.0 appears to fix the clipping and alignment issues.
One thing to note is paddingLeft and paddingRight no longer apply to SwitchCompat. Need to use layout_marginLeft and layout_marginRight, or e.g. add a parent FrameLayout instead.
One thing to note is paddingLeft and paddingRight no longer apply to SwitchCompat. Need to use layout_marginLeft and layout_marginRight, or e.g. add a parent FrameLayout instead.
vi...@gmail.com <vi...@gmail.com> #38
The nexus 7 appears to be fine now, and as mentioned in post 37 the left and right padding is completely broken.
Small devices are still not rendering the thumb. Tested on LG Optimus L3 II. This device is running 4.1.1 and has a screen size of 240x320 (should be illegal to make such small screens...)
Small devices are still not rendering the thumb. Tested on LG Optimus L3 II. This device is running 4.1.1 and has a screen size of 240x320 (should be illegal to make such small screens...)
da...@gmail.com <da...@gmail.com> #39
As mentioned above, as of appcompat 22.1.1 SwitchCompat padding values are ignored...
ch...@google.com <ch...@google.com> #40
#37 & 39: That issue 36949180 .
ma...@gmail.com <ma...@gmail.com> #41
I confirm too that the thumb is still not rendered on small devices :(
ma...@gmail.com <ma...@gmail.com> #42
Any news for new appcompat 22.2?
ch...@google.com <ch...@google.com> #43
This should be fixed for v22.2. I made some more modifications to the drawables.
vi...@gmail.com <vi...@gmail.com> #44
[Comment deleted]
vi...@gmail.com <vi...@gmail.com> #45
Tested and the problems appears to be fixed in 22.2
Padding is working correctly
Switch appears correctly on an old Nexus 7
Switch appears correctly on a small device like LG Optimus L3 II
I will continue testing for the next couple of weeks and report if I find anything wrong.
Padding is working correctly
Switch appears correctly on an old Nexus 7
Switch appears correctly on a small device like LG Optimus L3 II
I will continue testing for the next couple of weeks and report if I find anything wrong.
ig...@gmail.com <ig...@gmail.com> #46
SwitchCompat is still being clipped for me on Samsung Galaxy S4 (GT-I9500) with android 4.2.2 with appcompat-v7 22.2.0.
ig...@gmail.com <ig...@gmail.com> #47
Regarding #46 - I've figured out that if I supply a text to SwitchCompat - it works as intended and is not clipped anymore.
ha...@gmail.com <ha...@gmail.com> #49
[Comment deleted]
Description
Version used: 21.0.0
On a few devices, the thumb is not drawn on the switch, only the track is drawn (screenshot attached).
The devices I've seen where this happen are:
* Nexus 7 2012 (4.4.4)
* Samsung Galaxy Pocket Neo (4.1.2)
It's also reproducible on an emulated Nexus 7 with Android 4.4, but doesn't happen on a physical Nexus 4, 5, or 10, regardless of Android version.