2014-09-13 1 views
0

대화 상자 주위에 검은 색 테두리 (1px 너비)가있는 DialogFragment가 있습니다. 테두리가 아니라 그라데이션이 아니라면 대화 상자가 평평 해지기를 바랍니다. 어떻게 제거 할 수 있습니까?안드로이드 DialogFragment 1px border를 제거하는 방법

내가 성공하지 않고 다음 코드를 사용하여 시도했다 :

public Dialog onCreateDialog(Bundle savedInstanceState) { 

    ... 

    AlertDialog result = builder.create(); 
    result.setView(rootView, 0, 0, 0, 0); 
    result.getWindow().setBackgroundDrawableResource(android.R.color.transparent); 
    return result; 
    //return builder.create(); 
    } 

enter image description here

답변

1

당신의 고해상도/값/style.xml에 Dialog_No_Border 스타일을 추가 코드

public class QuickActionFragment extends DialogFragment { 

    @Override 
public Dialog onCreateDialog(Bundle savedInstanceState) { 
     Dialog m_dialog = new Dialog(QuickActionFragment.this, R.style.Dialog_No_Border); 
     LayoutInflater m_inflater = LayoutInflater.from(CustomDialogActivity.this); 
     View v = LayoutInflater.from(mContext).inflate(R.layout.view_quick_action, null, false); 
     // SET ALL THE VIEWS 
     m_dialog.setTitle(null); 
    m_dialog.setContentView(m_view); 
    m_dialog.show(); 
     return dialog; 
} 
} 

시도 파일.

<style name="Dialog_No_Border"> 
    <item name="android:windowIsFloating">true</item> 
    <item name="android:windowBackground">@color/transparent_color</item> 
</style> 

클린 프로젝트는 다음

+0

들으을 실행! 잘 작동합니다. @android : @ color/transparent_color 대신 color/transparent를 사용해야했습니다. – jmhostalet

관련 문제