我有一个自定义的DialogPreference,里面只含有一个日期选择器。除了下方展示的那个巨大的边框和标题之外,一切都正常。
我希望对话框只包含日期选择器:
我已经弄清楚如何将窗口标题设置为null来去掉标题,但是还有一个巨大的边框存在。
我的自定义布局:
我希望对话框只包含日期选择器:
我已经弄清楚如何将窗口标题设置为null来去掉标题,但是还有一个巨大的边框存在。
我的自定义布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<DatePicker
android:id="@+id/birthdayPicker"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:calendarViewShown="false"/>
</LinearLayout>
我已经尝试将线性布局的宽度/高度设置为wrap_content
、设置负边距以及其他一些hackey解决方案,但似乎没有什么作用。
到目前为止,我唯一的成功之处是重载onShow
并以编程方式将窗口大小设置为某个任意值——如宽度为300dp。这显然是超级hackey的,我更喜欢更优雅的解决方案。如果有帮助,非常感谢各位!
layout_width
需要一个wrap_content
? - Nasir