我創建它使用對話框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()' –