「牛角书」鸿蒙——简易指南针项目开发

zut_fyf
发布于 2022-12-17 21:26
6540浏览
0收藏

项目描述:

本项目是基于Java开发的一个鸿蒙程序小应用,实现一个简单的指南针,来演示传感器的常规使用方法(获取传感器并进行监听、取消监听等)。本项目可能存在着一些问题,大家可以帮忙指正。

项目运行结果:

「牛角书」鸿蒙——简易指南针项目开发-鸿蒙开发者社区

部分代码展示:

xml代码展示
<DirectionalLayout xmlns:ohos:height=“match_parent”
ohos:width=“match_parent”
ohos:orientation=“vertical”>
<Image
ohos:id=“+id:compassiconimg"ohos:height="300vp"ohos:width="300vp"ohos:layoutalignment="horizontalcenter"ohos:imagesrc="+id:compass_icon_img" ohos:height="300vp" ohos:width="300vp" ohos:layout_alignment="horizontal_center" ohos:image_src="media:compass”/>
<Text
ohos:id=“$+id:compass_angle_text”
ohos:height=“match_content”
ohos:width=“match_content”
ohos:text_size=“30fp”
ohos:text_weight=“720”
ohos:layout_alignment=“horizontal_center”/>

<Text
    ohos:height="35vp"
    ohos:width="match_parent"
    ohos:text="Your Phone Status"
    ohos:text_alignment="center"
    ohos:text_size="22fp"
    ohos:top_margin="30vp"/>

<DirectionalLayout
    ohos:height="40vp"
    ohos:width="match_parent"
    ohos:orientation="horizontal"
    ohos:top_margin="15vp">

    <Text
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:start_padding="15vp"
        ohos:end_padding="0vp"
        ohos:text="WiFi_Status: "
        ohos:text_size="16fp"/>

    <Text
        ohos:id="$+id:wifi_status"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:text_color="#7B7B7B"
        ohos:text_size="16fp"/>
</DirectionalLayout>

<DirectionalLayout
    ohos:height="40vp"
    ohos:width="match_parent"
    ohos:orientation="horizontal">

    <Text
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:start_padding="15vp"
        ohos:end_padding="0vp"
        ohos:text="Bluetooth_Status: "
        ohos:text_size="16fp"/>

    <Text
        ohos:id="$+id:bluetooth_status"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:text_color="#7B7B7B"
        ohos:text_size="16fp"/>
</DirectionalLayout>

<DirectionalLayout
    ohos:height="40vp"
    ohos:width="match_parent"
    ohos:orientation="horizontal">

    <Text
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:start_padding="15vp"
        ohos:end_padding="0vp"
        ohos:text="Airplane_Status: "
        ohos:text_size="16fp"/>

    <Text
        ohos:id="$+id:airplane_mode_status"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:text_color="#7B7B7B"
        ohos:text_size="16fp"/>
</DirectionalLayout>


<DirectionalLayout
    ohos:height="40vp"
    ohos:width="match_parent"
    ohos:orientation="horizontal">

    <Text
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:start_padding="15vp"
        ohos:end_padding="0vp"
        ohos:text="Country: "
        ohos:text_size="16fp"/>

    <Text
        ohos:id="$+id:country_text"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:text_color="#7B7B7B"
        ohos:text_size="16fp"/>
</DirectionalLayout>

<DirectionalLayout
    ohos:height="40vp"
    ohos:width="match_parent"
    ohos:orientation="horizontal">

    <Text
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:start_padding="15vp"
        ohos:end_padding="0vp"
        ohos:text="Language: "
        ohos:text_size="16fp"/>

    <Text
        ohos:id="$+id:language_text"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:text_color="#7B7B7B"
        ohos:text_size="16fp"/>
</DirectionalLayout>

<DirectionalLayout
    ohos:height="40vp"
    ohos:width="match_parent"
    ohos:orientation="horizontal">

    <Text
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:start_padding="15vp"
        ohos:end_padding="0vp"
        ohos:text="Time_Zone: "
        ohos:text_size="16fp"/>

    <Text
        ohos:id="$+id:timezone_text"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:text_color="#7B7B7B"
        ohos:text_size="16fp"/>
</DirectionalLayout>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.

</DirectionalLayout>

总结:

由于鄙人才疏学浅,致使本项目还有许多不完美之处,谢谢大家。

标签
收藏
回复
举报


回复
    相关推荐