Theme not applying to DialogFragment on Android

后端 未结 5 1849
孤独总比滥情好
孤独总比滥情好 2020-12-13 23:59

I\'m switching my old Dialogs to DialogFragment, but the themes and styles don\'t seem to be working.

I\'m using the DialogFragment from the compatibility library v

5条回答
  •  半阙折子戏
    2020-12-14 00:12

    I believe you need to set the theme on the actual Dialog and not the Fragment

    Use this constructor to create your AlertDialog:

     AlertDialog.Builder(Context context, int theme)
    

    ie

     AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), theme)
    

提交回复
热议问题