Custom dialog on Android: How can I center its title?

前端 未结 13 2199
后悔当初
后悔当初 2020-11-27 12:43

I\'m developing an Android application.

How can I center the title for a custom dialog that I\'m using?

13条回答
  •  不知归路
    2020-11-27 13:22

    If you don't call AlertDialog.Builder.setIcon() and AlertDialog.Builder.setTitle(), then your custom dialog will not show the built-in/default title View. In this case you are able to add your custom title View:

    AlertDialog.Builder.setView(View view)
    

    As soon as it is you who create this View it is possible to implement any type of alignment.

提交回复
热议问题