Custom TimePicker in order to reduce its size
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 TimePic开发者_开发技巧ker?
You can override the parent's layout inflation by calling the non-inflating parent constructor. For example:
public TimePickerCustom(Context context, AttributeSet attrs, int defStyle) {
super(context);
// custom layout // getLayoutInflater().inflate(...
}
精彩评论