简体   繁体   中英

Setting a title to a custom dialog box

I have created a custom dialog box extending the DialogFragment class. As stated in the Androïd developer's guide, I have set the style and theme of my dialog. I use the DialogFragment.STYLE_NORMAL style, which, I suppose, authorizes to set a title to the box. This seems confirmed by the fact that a style called DialogFragment.STYLE_NO_TITLE exists.

The problem is I can't find any function to set this title.

How can I do?

Thanks in advance for the time you will spend trying to help me.

只需调用getDialog().setTitle("My Dialog Title")来设置标题

I think you could call getDialog() to get the contained Dialog instance, then call setTitle on that with the required title.

A bit of a guess, since I'm not an Android developer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM