我创建它使用对话框fragement它看起来像这样默认情况下在DialogFragment中获取边距?
正如你可以看到我得到一个顶边距其中didnt设置对话框片段上的应用程序,你可以从我的XML文件
看<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_add_drop"
android:textSize="@dimen/tv_title_font_size"/>
<ImageButton
android:background="@null"
android:id="@+id/btn_close"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@drawable/ic_close"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/tv_title"
android:layout_alignBottom="@id/tv_title"
android:layout_marginRight="5dp"
/>
<EditText
android:id="@+id/et_drop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_title"
android:hint="@string/hint_et_drop"
android:padding="16dp"
android:inputType="textVisiblePassword"/>
<DatePicker
android:id="@+id/bpv_date"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_below="@id/et_drop"></DatePicker>
<Button
android:id="@+id/btn_add_it"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/bpv_date"
android:text="@string/str_add_it"
android:textAllCaps="false"/>
</RelativeLayout>
请告诉我为什么我得到这个保证金默认情况下,我该如何纠正这一点。
什么是'getWindow()'我的计划没有按不认识它 –
从哪里访问对话..?片段或活动..?尝试这些:getActivity()。getWindow()....或getDialog()。getWindow().....或最后dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); – Pkosta
我从Fragment子类访问。我想我不能在片段上下文中使用'getWindow()' –