在ICS意外的按钮填充 [英] Unexpected button padding on ICS

查看:137
本文介绍了在ICS意外的按钮填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在那有一个严密的布局非常小的填充状态列表绘制自定义按钮。该按钮看起来MDPI和HDPI设备不错,但填充是都错了我的摩托罗拉Xoom(ICS,MDPI设备)。修改填充和保证金属性不起任何作用。

I have a custom button with a state list drawable that has a tight layout with very little padding. This button looks great on MDPI and HDPI devices, but padding is all wrong on my Motorola Xoom (ICS, MDPI device). Modifying the 'padding' and 'margin' attributes does nothing.

任何人有什么可能会造成不必要的填充有什么建议?我相当有信心,国家列表绘制和9patch绘图资源都是精(它们完全呈现在其他M​​DPI设备)。

Anyone have any suggestions on what may be causing the unnecessary padding? I'm fairly confident that both the state list drawable and the 9patch drawables are fine (they render perfectly on other MDPI devices).

是一个什么样的最终产品看起来像一个例子 - 绿色边框表示其理想的外观(和路按钮看起来在其他设备上);品红边框表示对Xoom的外观。

Attached is an example of what the final product looks like - green border denotes its ideal appearance (and the way the button looks on other devices); magenta border denotes the appearance on the Xoom.

推荐答案

我开发一个appwidget时遇到的一些情况。我添加了一个按钮,并尝试修剪它的所有垫,使之小,但失败了,总有一个顶部填充和底部填充。我相信这是Android系统的限制,使appwidget所有按钮都足够大,为最终用户挖掘。不过有时候我们坚持小按钮,由于老板......作为Melllvar指出的解决方法,我用了一个可成为焦点,点击TextView的,而不是一个按钮,它按预期工作。

I encountered some situation when developing a appwidget. I added a button and try to trim all paddings of it to make it small but failed, there are always a top padding and a bottom padding. I believe it's a constraint of Android system, so that all buttons in appwidget are large enough for end users to tap. However sometimes we insist small buttons due to boss... As the workaround Melllvar indicated, I used a focusable, clickable TextView instead of a Button, it works as expected.

这篇关于在ICS意外的按钮填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆