HarmonyOS 设置图标在Text 旁边
生活随笔
收集整理的這篇文章主要介紹了
HarmonyOS 设置图标在Text 旁边
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
當Text 使用element_left的時候,圖標在文本的左側(cè)?
當Text 使用element_right的時候,圖標在文本的右側(cè)??
當Text 使用element_top的時候,圖標在文本的上側(cè)??
當Text 使用element_bottom的時候,圖標在文本的下側(cè)??
其中 element_padding 是設(shè)置圖標與文本的間距的
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_parent"ohos:width="match_parent"ohos:orientation="vertical"><Textohos:id="$+id:text"ohos:height="match_content"ohos:width="match_content"ohos:text="心情"ohos:element_right="$media:icon"ohos:element_padding="10vp"ohos:text_size="22fp"ohos:top_margin="50vp"/><Textohos:id="$+id:text1"ohos:height="match_content"ohos:width="match_content"ohos:text="心情"ohos:element_padding="10vp"ohos:element_left="$media:icon"ohos:text_size="22fp"ohos:top_margin="50vp"/><Textohos:id="$+id:text2"ohos:height="match_content"ohos:width="match_content"ohos:text="心情"ohos:element_padding="10vp"ohos:element_top="$media:icon"ohos:text_size="22fp"ohos:top_margin="50vp"/><Textohos:id="$+id:text3"ohos:height="match_content"ohos:width="match_content"ohos:text="心情"ohos:element_padding="10vp"ohos:element_bottom="$media:icon"ohos:text_size="22fp"ohos:top_margin="50vp"/></DirectionalLayout>
效果圖如下:
?
總結(jié)
以上是生活随笔為你收集整理的HarmonyOS 设置图标在Text 旁边的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VANS的鞋子40.5码数相当于NIKE
- 下一篇: C++ 继承与多继承