언어 설정

Menu
Sites
Language
How to Change the Header Title Alignment?
Question about Tizen::Ui::Controls::Header.
 
When the header style is "HEADER_STYLE_TITLE",
Is it possible to align the header title to the center horizontally?
or need to create a custom control?

Responses

4 댓글
Alex Dem

Hi,
I did not find such property in Native UI builder and such api in Tizen::Ui::Controls::Header class (there is no api like pHeader->SetTitleTextPosition(x,y) which could be very useful).
I think to create a custom control (using UI Customizer) is the preferable way.
Alexey.

RAJENDRA NAIK

The Header title comes at left by default. Can you please check SetItemAt function in Header class for your use case. For label, you can do in this way

pLabel->SetTextHorizontalAlignment(ALIGNMENT_CENTER ).Please let me know if you need any further information.

Best Regards,

Rajendra

Alex Dem

Unfortunately HeaderItems are not applicable for HEADER_STYLE_TITLE mode and SetTextHorizontalAlignment is not applicable for Header, but
1) You could use Label instead of Header at all.
2) You could place your Label under invisible/empty Header. In this case place for header will be reserved on your form and Point(x=0,y=0) will be under the header (see code sample which copies Header's color to Label and allows to configure Title text):

    Header* pHeader = GetHeader();
    Color headerColor=pHeader->GetColor();
    Rectangle header= pHeader->GetBounds();
    pHeader->SetColor(Color(255,255,255,0));//to do header transparent
    Label* pLabel= new Label;
    pLabel->Construct(Rectangle(0,-header.height,header.width,header.height), L"Title Text");
    pLabel->SetTextConfig(50, LABEL_TEXT_STYLE_BOLD);
    pLabel->SetBackgroundColor(headerColor);
    pLabel->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
    AddControl(pLabel);

3)Or you could use background image with pictured title for header  (it is not elegant at all)
Alexey.

Yusuke Sugaya

Thank you for the advice, Alexey.

 

I was thinking the same as your idea of No.1.

But, I would choose No.2 this time.

'cause It wil be easier to manage the client area and so no.

Anyway, There are quite many specification in Tizen are strange in compare with others such as iOS.

Yusuke