[文章]

鸿蒙应用开发-DevEco Studio 模板体验(三)

2021-5-5 11:17:24  204 harmonyos
分享
2
设置页面框架:
图片1.png 图片2.png
部分代码如下:
<DependentLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="$float:singleCarDVIewHeight"ohos:width="match_parent">

    <Textohos:id="$+id:item_content_text"ohos:height="$float:singleCardViewTextHeight"ohos:width="match_content"ohos:align_parent_left="true"ohos:center_in_parent="true"ohos:left_margin="$float:singleCardViewLeftMargin"ohos:text_color="$color:textColorPrimary"ohos:text_size="$float:textSizeBody1"/>

    <Imageohos:id="$+id:item_right_icon"ohos:height="match_content"ohos:width="match_content"ohos:align_parent_right="true"ohos:center_in_parent="true"ohos:image_src="$graphic:icon_right_grey"ohos:right_margin="$float:singleCardViewRightMargin"/>

    <Textohos:id="$+id:item_right_content_text"ohos:height="$float:singleCardViewRightTextHeight"ohos:width="match_content"ohos:center_in_parent="true"ohos:left_of="$id:item_right_icon"ohos:right_margin="$float:singleCardViewRightTextRightMargin"ohos:text_color="$color:textColorSecondary"ohos:text_size="$float:textSizeBody2"/>
</DependentLayout>
页面滞留界面跳转
图片3.png
图片4.png
部分代码如下:
<DirectionalLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_content"ohos:width="match_parent"ohos:bottom_margin="$float:margin_common"ohos:left_margin="$float:breadth_common"ohos:orientation="horizontal"ohos:right_margin="$float:breadth_common"ohos:top_margin="$float:margin_common">

        <DirectionalLayoutohos:height="match_parent"ohos:width="match_content"ohos:left_padding="$float:breadth_common"ohos:orientation="horizontal"ohos:weight="1">
            <Imageohos:id="$+id:item_icon"ohos:height="$float:breadth_checkbox_image"ohos:width="$float:breadth_checkbox_image"ohos:layout_alignment="vertical_center"ohos:left_margin="$float:margin_checkbox_image"ohos:right_margin="$float:breadth_checkbox_image_margin"/>
            <DirectionalLayoutohos:id="$+id:text_layout"ohos:height="match_content"ohos:width="match_content"ohos:orientation="vertical">
                <Textohos:id="$+id:item_content_text"ohos:height="match_content"ohos:width="match_content"ohos:layout_alignment="left"ohos:text_size="$float:checkbox_main_text_size"/>
                <Textohos:id="$+id:item_status_text"ohos:height="match_content"ohos:width="match_content"ohos:layout_alignment="left"ohos:multiple_lines="true"ohos:text_size="$float:checkbox_minor_text_size"ohos:top_margin="$float:margin_between_texts"/>
            </DirectionalLayout>
        </DirectionalLayout>

        <DirectionalLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:id="$+id:checkbox_layout"ohos:height="$float:height_checkbox_1"ohos:width="match_content"ohos:bottom_margin="$float:margin_common"ohos:layout_alignment="right"ohos:orientation="horizontal"ohos:right_margin="$float:breadth_checkbox"ohos:top_margin="$float:margin_common">
            <Imageohos:id="$+id:item_right_checkbox"ohos:height="$float:height_checkbox_image"ohos:width="$float:width_checkbox_image"ohos:bottom_margin="$float:margin_common2"ohos:image_src="$media:EnabLED"ohos:layout_alignment="vertical_center"ohos:top_margin="$float:margin_common2"/>
        </DirectionalLayout>
    </DirectionalLayout>

</DirectionalLayout>
商品框架:
图片5.png
图片6.png
图片7.png
部分代码:
<DirectionalLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_content"ohos:width="match_parent"ohos:bottom_margin="$float:margin_common"ohos:left_margin="$float:breadth_common"ohos:orientation="horizontal"ohos:right_margin="$float:breadth_common"ohos:top_margin="$float:margin_common">

    <DirectionalLayoutohos:height="match_parent"ohos:width="match_content"ohos:left_padding="$float:breadth_common"ohos:orientation="horizontal"ohos:weight="1">
        <Imageohos:id="$+id:item_icon"ohos:height="$float:breadth_checkbox_image"ohos:width="$float:breadth_checkbox_image"ohos:layout_alignment="vertical_center"ohos:left_margin="$float:margin_checkbox_image"ohos:right_margin="$float:breadth_checkbox_image_margin"/>
        <DirectionalLayoutohos:id="$+id:text_layout"ohos:height="match_content"ohos:width="match_content"ohos:orientation="vertical">
            <Textohos:id="$+id:item_content_text"ohos:height="match_content"ohos:width="match_content"ohos:layout_alignment="left"ohos:text_size="$float:checkbox_main_text_size"/>
            <Textohos:id="$+id:item_status_text"ohos:height="match_content"ohos:width="match_content"ohos:layout_alignment="left"ohos:multiple_lines="true"ohos:text_size="$float:checkbox_minor_text_size"ohos:top_margin="$float:margin_between_texts"/>
        </DirectionalLayout>
    </DirectionalLayout>

    <DirectionalLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:id="$+id:checkbox_layout"ohos:height="$float:height_checkbox_1"ohos:width="match_content"ohos:bottom_margin="$float:margin_common"ohos:layout_alignment="right"ohos:orientation="horizontal"ohos:right_margin="$float:breadth_checkbox"ohos:top_margin="$float:margin_common">
        <Imageohos:id="$+id:item_right_checkbox"ohos:height="$float:height_checkbox_image"ohos:width="$float:width_checkbox_image"ohos:bottom_margin="$float:margin_common2"ohos:image_src="$media:Enabled"ohos:layout_alignment="vertical_center"ohos:top_margin="$float:margin_common2"/>
    </DirectionalLayout>
完整代码地址:


dianzi 2021-5-5 11:42:13
劳动最光荣啊
回复

举报

评论

您需要登录后才可以回帖 登录 | 注册

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容图片侵权或者其他问题,请联系本站作侵删。 侵权投诉
发文章
快速回复
扫一扫分享
返回顶部 返回列表