自定义 TimePicker 以减小其大小
我想做的就是减小默认 TimePicker 的大小,但是我没有成功。所以 - 我创建了一个自定义 TimePicker,即我有一个派生自 TimePicker 的类(称为 TimePickerCustom),以及一个与原始 TimePicker 内容完全相同的 XML 文件(除了我计划使 NumberPicker 尺寸更小)。
我需要在 TimePickerCustom 中定义一个以 AttributeSet 作为参数的构造函数,以便正确地膨胀 XML,当然,我需要在此处为此调用父类的构造函数。问题是,这些构造函数会膨胀原始的 TimePicker xml,所以我仍然看到默认的 TimePicker 小部件!
我应该如何设置才能只看到我的自定义 TimePicker 小部件?或者是否有另一种方法可以简单地减小默认 TimePicker 的大小?
All I would like to do is reduce the size of the default TimePicker, however I have been unsuccessful with this. So - I have created a custom TimePicker, ie I have a class that derives from TimePicker (call it TimePickerCustom), and an XML file that has exactly the same contents as the original TimePicker (except I plan to make the NumberPicker sizes smaller).
I need to define one of the constructors that have AttributeSet as a parameter in my TimePickerCustom, in order to inflate the XML properly, and of course I need to call the parent class' constructor for this in here. The problem is, that these constructors inflate the original TimePicker xml, so I still see the default TimePicker widget!
How should I set this up so that I can see only my custom TimePicker widget? Or is there another way to simply reduce the size of the default TimePicker?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过调用非膨胀父构造函数来覆盖父级的布局膨胀。例如:
You can override the parent's layout inflation by calling the non-inflating parent constructor. For example: