How to change theme for AlertDialog

前端 未结 15 2067
名媛妹妹
名媛妹妹 2020-11-22 09:14

I was wondering if someone could help me out. I am trying to create a custom AlertDialog. In order to do this, I added the following line of code in styles.xml



        
15条回答
  •  一整个雨季
    2020-11-22 09:52

    You can directly assign a theme when you initiate the Builder:

    AlertDialog.Builder builder = new AlertDialog.Builder(
                        getActivity(), R.style.MyAlertDialogTheme);
    

    Then customize your theme in your values/styles.xml

    
    
    

提交回复
热议问题