applibgroup / HarmonyOS-Knowledgebase

This repository contains code samples of HarmonyOS Training
Apache License 2.0
15 stars 6 forks source link

How can we Customize the title to the dialog? #52

Closed anshulgoel72 closed 3 years ago

anshulgoel72 commented 3 years ago

Describe the query

I have created a custom dialog which is inflating a layout file in which I can add the components according to my need. I was wondering if I can also customize the dialog title. Like, I want to add some images along with the title. How can I do that?

Create the query with harmonyos tag in stackoverflow and share the link here:

https://stackoverflow.com/questions/68591287/how-can-we-customize-the-title-to-the-dialog

Additional information

Developer Platform: Windows
DevEco Studio version: 2.1.0.303
SDK API version: 5
SDK version: 2.1.1.21
Device: Not Required
Device OS version: Not Required

samuel-abhishek commented 3 years ago

If you are using the CommonDialog in HarmonyOS for customization of the dialog, Harmony OS provides an API where you can pass the custom layout for the title component i.e :

setTitleCustomComponent​(DirectionalLayout component)

You may check this documentation for additional information