Resizing of DatePicker in android

后端 未结 5 1198
清酒与你
清酒与你 2021-01-11 17:17

How can I reduce the size (height and width) of a DatePicker? Is there any built-in method available for this?

5条回答
  •  感情败类
    2021-01-11 17:47

    I think we can not reduce the actual size of the date picker view but we can use scaling and negative padding properties to make the date picker look smaller.

    Scaling down the date picker by using android:scaleY and android:scaleX attributes will make the picker to look smaller but still take the same amount of view space inside the activity/ fragment. To remove the extra space around the scaled down version of date picker we can use negative padding.

    For example, if we want to place two scaled down version of date pickers side by side without leaving much gap between them, then we can do so by adjusting the padding as shown below:

    
         
    
        
    
    

    Above example shows placing the 2 date pickers side by side but we can place any other view beside a date picker by adjusting the padding as shown above.

提交回复
热议问题