6

enter image description hereDialogFragment एंड्रॉयड में शीर्ष पर नीली रेखा है 4.4.2

वहाँ एक नीले रंग की मेरी संवाद टुकड़ा के शीर्ष कि मैं मिल बंद छुटकारा नहीं कर सकते हैं (मैं भी नहीं जानता कि क्यों यह में प्रदर्शित करता है पर प्रदर्शित होने लाइन है । पहले स्थान पर किसी को भी यह कैसे से छुटकारा पाने के लिए पर पता है

मैं कई उपकरणों पर यह परीक्षण किया है और इसे बाद में Android संस्करण पर बस ठीक काम करता है

मेरे कोड:।

private void setupDialog() { 
    final Dialog dialog = getDialog(); 
    final Window window = dialog.getWindow(); 

    window.setBackgroundDrawable(new ColorDrawable(0)); 
    window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 
    } 

लेआउट:

 <?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tiktok="http://schemas.android.com/apk/res-auto" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/settings_bg"> 

    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true"> 

     <ImageView 
      android:id="@+id/close_btn" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_margin="15dp" 
      android:src="@drawable/pressable_close_btn"/> 

     <com.cyscorpions.timekeeper.customviews.TKTextView 
      android:id="@+id/settings_title" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="@dimen/dp_40" 
      android:text="@string/settings_allcaps" 
      android:textColor="@color/timekeeper_blue" 
      android:textSize="@dimen/sp_60" 
      tiktok:useBoldFont="true"/> 

     <com.cyscorpions.timekeeper.customviews.TKTextView 
      android:id="@+id/account_name_instruction" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/settings_title" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="@dimen/dp_20" 
      android:text="@string/subdomain_instruction" 
      android:textColor="@color/gray" 
      android:textSize="@dimen/sp_30"/> 

     <RelativeLayout 
      android:id="@+id/info_field" 
      android:layout_width="wrap_content" 
      android:layout_height="@dimen/dp_70" 
      android:layout_alignLeft="@+id/submit_btn" 
      android:layout_below="@id/account_name_instruction" 
      android:layout_centerHorizontal="true" 
      android:layout_marginLeft="2dp" 
      android:layout_marginTop="@dimen/dp_20"> 

      <com.cyscorpions.timekeeper.customviews.TKAppCompatEditText 
       android:id="@+id/subdomain_textfield" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:background="@drawable/text_field_bg" 
       android:hint="@string/textfield_account_hint" 
       android:inputType="text" 
       android:textColor="@color/gray" 
       android:textColorHint="@color/gray" 
       android:textSize="@dimen/sp_20" 
       tiktok:setTextFieldFont="@string/montserrat_reg"/> 

      <com.cyscorpions.timekeeper.customviews.TKTextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_toRightOf="@id/subdomain_textfield" 
       android:text="@string/domain_suffix" 
       android:textColor="@color/gray" 
       android:textSize="@dimen/sp_25"/> 
     </RelativeLayout> 

     <RelativeLayout 
      android:id="@+id/error_tooltip" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_below="@id/settings_title"> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@drawable/error_tooltip" 
       android:shadowColor="@color/black"/> 

      <com.cyscorpions.timekeeper.customviews.TKTextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_marginTop="@dimen/dp_20" 
       android:text="@string/field_required" 
       android:textColor="@color/white" 
       android:textSize="@dimen/sp_30"/> 
     </RelativeLayout> 

     <com.cyscorpions.timekeeper.customviews.TKButton 
      android:id="@id/submit_btn" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/info_field" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="@dimen/dp_10" 
      android:background="@drawable/pressable_submit_btn" 
      android:text="@string/submit_allcaps" 
      android:textColor="@color/white" 
      android:textSize="@dimen/sp_30" 
      tiktok:hasDarkerPressedState="true" 
      tiktok:useDefaultDrawable="true"/> 

    </RelativeLayout> 

</RelativeLayout> 

उत्तर

10

मैं इसे प्रकट होता है जब अभी भी एक शीर्षक पट्टी है वहाँ लगता है। मैं सिर्फ शीर्षक पट्टी को छुपा दिया और यह सिर्फ ठीक काम करता है ..

dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); 
+3

थीस कोड की ई लाइनें तभी काम करेंगी जब हम इसे 'setContentView' से पहले रख दें अन्यथा यह अपवाद फेंक देगा :) –

+0

इसके अलावा यह कुछ लेआउट गुरुत्वाकर्षण मुद्दों को हल करता है;) – Tobliug

-2

उपयोग इस परिवर्तन:

अपने DialogFragment पर:

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    setStyle(android.support.v4.app.DialogFragment.STYLE_NO_FRAME, R.style.my_dialog_style); 
} 
अपनी शैली R.style.my_dialog_style पर

निम्नलिखित जोड़ें:

<item name="android:windowContentOverlay">@null</item> 
संबंधित मुद्दे