ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

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

2021-05-12 17:03:33  阅读:218  来源: 互联网

标签:DevEco 鸿蒙 float content Studio ohos margin id match


设置页面框架:

1e3aa7498bc0c1caa82103834ede1364.png

12f5b30cd097d651f61e0283422df9ef.png 

部分代码如下:

<DependentLayout
    xmlns:ohos="http://schemas.huawei.com/res/ohos"
    ohos:height="$float:singleCardViewHeight"
    ohos:width="match_parent">

    <Text
        ohos: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"/>

    <Image
        ohos: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"/>

    <Text
        ohos: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>

 

 

页面滞留界面跳转
2f5e41e55ebccff057a999b71d3ac422.png

2b300310e7ef183d6419cc9d4df172b7.png 

 

部分代码如下:

<DirectionalLayout
        xmlns: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">

        <DirectionalLayout
            ohos:height="match_parent"
            ohos:width="match_content"
            ohos:left_padding="$float:breadth_common"
            ohos:orientation="horizontal"
            ohos:weight="1">
            <Image
                ohos: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"/>
            <DirectionalLayout
                ohos:id="$+id:text_layout"
                ohos:height="match_content"
                ohos:width="match_content"
                ohos:orientation="vertical">
                <Text
                    ohos: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"/>
                <Text
                    ohos: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>

        <DirectionalLayout
            xmlns: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">
            <Image
                ohos: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>

 

 

 

 

 

商品框架:

003fb81c500dea229f51ac991a98c5bc.png 

71dbe215ec9db8dc8617c42807859bec.png 

c7597fd0819e2aa6fadabb1768b057f5.png 

部分代码:

<DirectionalLayout
    xmlns: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">

    <DirectionalLayout
        ohos:height="match_parent"
        ohos:width="match_content"
        ohos:left_padding="$float:breadth_common"
        ohos:orientation="horizontal"
        ohos:weight="1">
        <Image
            ohos: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"/>
        <DirectionalLayout
            ohos:id="$+id:text_layout"
            ohos:height="match_content"
            ohos:width="match_content"
            ohos:orientation="vertical">
            <Text
                ohos: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"/>
            <Text
                ohos: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>

    <DirectionalLayout
        xmlns: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">
        <Image
            ohos: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>

 

完整代码地址:https://gitee.com/jltfcloudcn/jump_to/tree/master/mbty4


原文链接:https://developer.huawei.com/consumer/cn/forum/topic/0201561270740160431?fid=0101303901040230869

原作者:蛟龙腾飞


标签:DevEco,鸿蒙,float,content,Studio,ohos,margin,id,match
来源: https://blog.51cto.com/u_14772288/2771369

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有