From 1aecd5965001814396586ead0dd2f5862c5c7849 Mon Sep 17 00:00:00 2001 From: youzhi92 Date: Wed, 29 Sep 2021 19:28:04 +0800 Subject: [PATCH] issueNo: I4C7HL Description: make the vertical align to top version lower than 5 Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: youzhi92 Change-Id: If41e8d6765b721440e8237e73c6ff80f5dbc89fa --- frameworks/src/core/components/text_component.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frameworks/src/core/components/text_component.cpp b/frameworks/src/core/components/text_component.cpp index b5fbec9..f5b5408 100644 --- a/frameworks/src/core/components/text_component.cpp +++ b/frameworks/src/core/components/text_component.cpp @@ -245,7 +245,12 @@ void TextComponent::SetTextAlign(UILabelTypeWrapper &label, const AppStyleItem * stylePropValue); break; } - label.SetAlign(align, UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); + const int32_t defaultVerticalAlignCenterApiVersion = 5; + if (JsAppContext::GetInstance()->GetTargetApi() < defaultVerticalAlignCenterApiVersion) { + label.SetAlign(align, UITextLanguageAlignment::TEXT_ALIGNMENT_TOP); + } else { + label.SetAlign(align, UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); + } } } // namespace ACELite } // namespace OHOS