Is there any way to make smaller DatePicker and TimePicker (but to be visible all parts ) in Android ? I tried to set layout_width="130dp" but then DatePicker isn't visible, just left upper corner.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
This worked for me to fit a date and time picker in a dialogue with a custom layout in landscape mode on a small screen. Set the weightsum of a container (LinarLayout) to 100 and then fill it with widgets adding up to 100 in layout_weight property.
Use properties follow:
Example smaller 80% original
You can simple scale like this:
android:scaleY="0.5" android:scaleX="0.5"
to get the half of the size.
And to get a smaller padding,
android:padding="-20dp"
Looking from the framework the picker may overlap other views, but in the app, it will not.
The padding is going to work perfectly and the buttons also.
Instead of using "dp" for the layout width , use percentages in weight to make it smaller. For android:layout_weight to be effective, put android:layout_width to 0 dip.
android:layout_height="wrap_content"
android:layout_weight=".33"
android:layout_width="0dip"
android:textSize="12sp"
Another solution:
Put it in a
LinearLayout
and set the height of theLinearLayout
manually(This actually works and others don't) After much searching this worked:
The
android:scaleX="0.7"
is what shrinked the visible picker (it works forDatePicker
andTimePicker
) and theandroid:layout_marginLeft="-30dp"
allowed for the space to be reduced.Note: All attempts at using
android:padding="-30dp"
did not work and usingandroid:layout_margin="-30dp"
(without a side specified) also did not work. Hopefully this helps those who were as lost as meP.S. Google get your freaking DatePicker API fixed!