Issue with NumberPicker images showing up offset
I used the example code from http://www.quietlycoding.com/?p=5 and compiled the example and it displayed fine. When I copied the code into my application the graphic of the increment and decrement buttons show up offset to开发者_JAVA技巧 the right. Any ideas what I did wrong?
I also tried using his revised code from http://www.quietlycoding.com/?p=32 and got the same results.
It's something really weird with n-patch images. IIRC you need individual drawables for each density. Maybe you can get by with just drawable-hdpi versions.
See my "patch" for this against ADW Launcher https://github.com/teslacoil/adw_launcher/commit/32cf073725d129149c903cb7b924279336b4bff3
You can use my number picker. (I struggled with the very same issue.)
It's a port from original number picker source, enhanced for public use (custom attributes + view or preference which will persist an integer) and it also includes hdpi
resources (which are compressed to minimum required size).
There's also a great feature (at least I think so):
You can use it in a horizontal way by specifying android:orientation="horizontal"
.
精彩评论