赞
踩
概述:
本次项目是我这个学期鸿蒙应用开发的结课作业。是根据平时所学内容以及自己手机上面的通讯录做出来的demo。
DevEco Studio
1. 具有显示联系人列表、添加联系人信息、删除联系人、修改联系人信息等功能;
2.储存联系人信息时并未使用数据库,而是通过使用配置文件写入输入的数据,并进行读取或修改;
3.还具有修改底部状态栏配色的功能。
1.在编辑时,只有输入姓名,才会出现确认按钮:实现这一操作,只需要检查姓名输入框中的内容是否为空,如果是空,则将该组件隐藏,如果不是空则将该组件设置为可见。
2.实现底部配色主题得切换:将底部得配色归纳成四种Rgb配色,统一得存放在BottomBarColor.java文件中,使其保持static/final,并且编写相应得static函数操作。当用户选择了某个主题配色并点击“应用”按钮后,会调用设置相应得颜色,即可达到切换配色得目的。
ability_main.xml:
- <?xml version="1.0" encoding="utf-8"?>
- <DirectionalLayout
- xmlns:ohos="http://schemas.huawei.com/res/ohos"
- ohos:id="$+id:main_rootdl"
- ohos:height="match_parent"
- ohos:width="match_parent"
-
- ohos:orientation="vertical"
- ohos:alignment="horizontal_center"
-
- ohos:background_element="$graphic:background_ability_main">
- <DirectionalLayout
- ohos:id="$+id:main_rootdl_ddl1"
- ohos:height="0"
- ohos:weight="0.6"
- ohos:width="match_parent"
-
-
- ohos:orientation="vertical"
- ohos:alignment="horizontal_center">
- </DirectionalLayout>
-
- <DirectionalLayout
- ohos:id="$+id:main_rootdl_ddl2"
- ohos:height="0"
- ohos:weight="8.8"
- ohos:width="match_parent"
-
- ohos:top_margin="5vp"
-
- ohos:background_element="$graphic:background_ddl2">
- </DirectionalLayout>
-
- <DirectionalLayout
- ohos:id="$+id:main_rootdl_ddl3"
- ohos:height="0"
- ohos:weight="0.6"
- ohos:width="match_parent"
-
- ohos:top_margin="5vp"
- ohos:bottom_margin="5vp"
- ohos:left_margin="45vp"
- ohos:right_margin="45vp"
-
- ohos:orientation="horizontal"
- ohos:alignment="vertical_center"
-
- ohos:background_element="$graphic:background_ddl3">
- <Button
- ohos:id="$+id:ddl3_butpeople"
- ohos:height="match_parent"
- ohos:width="0"
- ohos:weight="1"
-
- ohos:margin="3vp"
-
- ohos:text="$string:people"
- ohos:text_alignment="center"
- ohos:text_size="25vp"
- ohos:text_color="#FFB35353"
-
- ohos:background_element="$graphic:background_bottombutton">
- </Button>
- <Button
- ohos:id="$+id:ddl3_butedit"
- ohos:height="match_parent"
- ohos:width="0"
- ohos:weight="1"
-
- ohos:margin="3vp"
-
- ohos:text="$string:edit"
- ohos:text_alignment="center"
- ohos:text_size="25vp"
- ohos:text_color="#FF1086CA"
-
- ohos:background_element="$graphic:background_bottombutton">
- </Button>
- <Button
- ohos:id="$+id:ddl3_butconfig"
- ohos:height="match_parent"
- ohos:width="0"
- ohos:weight="1"
-
- ohos:margin="3vp"
-
- ohos:text="$string:config"
- ohos:text_alignment="center"
- ohos:text_size="25vp"
- ohos:text_color="#FF79086A"
-
- ohos:background_element="$graphic:background_bottombutton">
- </Button>
- </DirectionalLayout>
- </DirectionalLayout>

ability_edit.xml:
- <?xml version="1.0" encoding="utf-8"?>
- <DirectionalLayout
- xmlns:ohos="http://schemas.huawei.com/res/ohos"
- ohos:id="$+id:edit_area_rootdl"
- ohos:height="match_parent"
- ohos:width="match_parent"
-
- ohos:orientation="vertical"
- ohos:alignment="horizontal_center">
- <DirectionalLayout
- ohos:id="$+id:edit_name_dlyt"
- ohos:height="60vp"
- ohos:width="match_parent"
-
- ohos:margin="10vp"
-
- ohos:orientation="horizontal"
- ohos:alignment="vertical_center">
- <Text
- ohos:id="$+id:edit_nametext"
- ohos:height="match_parent"
- ohos:width="0"
- ohos:weight="3"
-
-
- ohos:text="待输入"
- ohos:text_alignment="center"
-
- ohos:multiple_lines="true"
- ohos:auto_font_size="true"
- ohos:text_color="#FF6D37D2"
-
- ohos:background_element="$graphic:background_edit_addnametext">
- </Text>
- <TextField
- ohos:id="$+id:edit_nametfd"
- ohos:height="match_parent"
- ohos:width="0"
- ohos:weight="7"
-
-
- ohos:hint="姓名"
- ohos:text_alignment="center"
- ohos:text_size="20vp"
- ohos:hint_color="gray"
-
- ohos:background_element="$graphic:background_edit_addtfd">
- </TextField>
- </DirectionalLayout>
- <DirectionalLayout
- ohos:id="$+id:edit_tel_dlyt"
- ohos:height="40vp"
- ohos:width="match_parent"
-
- ohos:margin="5vp"
-
- ohos:orientation="horizontal"
- ohos:alignment="vertical_center">
- <Button
- ohos:id="$+id:edit_addtel_but"
- ohos:height="match_parent"
- ohos:width="40vp"
-
-
- ohos:text="+"
- ohos:text_alignment="center"
- ohos:text_size="20vp"
- ohos:text_color="green"
-
- ohos:background_element="$graphic:background_edit_addbutton">
- </Button>
- <TextField
- ohos:id="$+id:edit_teltfd"
- ohos:height="match_parent"
- ohos:width="match_parent"
-
-
- ohos:hint="电话"
- ohos:text_alignment="center"
- ohos:text_size="20vp"
- ohos:hint_color="gray"
-
- ohos:background_element="$graphic:background_edit_addtfd">
- </TextField>
- </DirectionalLayout>
- <DirectionalLayout
- ohos:id="$+id:edit_email_dlyt"
- ohos:height="40vp"
- ohos:width="match_parent"
-
- ohos:margin="5vp"
-
- ohos:orientation="horizontal"
- ohos:alignment="vertical_center">
- <Button
- ohos:id="$+id:edit_addemail_but"
- ohos:height="match_parent"
- ohos:width="40vp"
-
-
- ohos:text="+"
- ohos:text_alignment="center"
- ohos:text_size="20vp"
- ohos:text_color="green"
-
- ohos:background_element="$graphic:background_edit_addbutton">
- </Button>
- <TextField
- ohos:id="$+id:edit_emailtfd"
- ohos:height="match_parent"
- ohos:width="match_parent"
-
-
- ohos:hint="邮件"
- ohos:text_alignment="center"
- ohos:text_size="20vp"
- ohos:hint_color="gray"
-
- ohos:background_element="$graphic

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。