NumberPicker 图像显示偏移的问题
我使用了 http://www.quietlycoding.com/?p=5 中的示例代码并编译了示例并且显示良好。当我将代码复制到应用程序中时,增量和减量按钮的图形显示为向右偏移。有什么想法我做错了什么吗?
我还尝试使用他修改后的代码 http://www.quietlycoding.com/?p=32 并得到相同的结果。
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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于 n 块图像来说,这确实很奇怪。 IIRC 您需要针对每种密度单独绘制。也许您只需使用drawable-hdpi 版本就可以了。
请参阅我针对 ADW Launcher 的“补丁”
https://github.com/teslacoil/adw_launcher/commit/32cf073725d129149c903cb7b924279336b4bff3
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
您可以使用我的号码选择器。 (我也遇到过同样的问题。)
它是来自原始数字选择器源的端口,针对公共使用进行了增强(自定义属性+视图或首选项将保留一个整数),并且它还包括
hdpi
资源(被压缩到所需的最小大小)。还有一个很棒的功能(至少我是这么认为):
您可以通过指定
android:orientation="horizontal"
以水平方式使用它。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"
.