随着移动通信技术的发展和无线数据业务的进步,手机已被赋予了通话意外的其他许多功能。
本设计使用安卓 Android studio 设计技术开发了一种运用在 android 系统上的手机天气预报软件系统,本系统通过选择城市来获得天气,空气指数、气温等信息。基于手机的天气预报系统软件可以使用户对于各个天气预报情况的实时掌握,极大的方便了用户的出行和行程安排,避免了不必要的麻烦,具有很强的实用性。
关键词:Android studio、安卓、天气预报系统、天气预报
-
程序设计思路APP 的主题与名称
天气是能决定许多人一天情绪和日常关注的问题,在以前,许多因为突如其来的坏天气而让农作物被毁,以及在晴天时晾晒衣物,却被突如其来的磅礴大雨全部打湿。所以一款准确的天气预报的程序是非常需要的,“Weather Of Gu” app,是一款能够实时预知天气,以及预知未来天气的app,因本人姓氏原因,所以将软件命名为:“Weather Of Gu”。
APP 的页面设计
根据当下年轻人的风格,程序使用相对青春的设计思路,大部分由ICON矢量图实现,界面简洁但又不能失去功能的完整性。
功能的设计
- 主页:用户能通过主页,知道当前的气温、湿度、天气情况、风力与风向,并且能够看见未来几天的天气情况和气温等。
- 关注:在当前选择的城市左上角,用户可以通过点击加号,查询家人的城市,以及亲朋好友的城市。方便用户能够快速进行查看。
- 主页列表:主页列表是用户当前城市,用户可以在这里看见当前所在城市当前的天气情况以及气温,还有湿度、生活指数还有未来七日的天气情况。
编写软件:Android studio
使用技术:Java,xml,和风天气官方 API 接口,JSON
-
欢迎界面:
XML
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/imag3"
tools:context=".activity.MainActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:gravity="center"
android:text="Weather Of Gu"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</FrameLayout>
-
主页
和风天气官网
Xml代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.WeatherActivity"
android:background="@drawable/img1">
<ImageView
android:id="@+id/bing_pic_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager_weather"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="55dp">
</androidx.viewpager.widget.ViewPager>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/weather_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:orientation="vertical">
<include layout="@layout/title" />
<!-- <include layout="@layout/title" />-->
<include layout="@layout/now" />
<include layout="@layout/aqi" />
<include layout="@layout/forecast" />
<include layout="@layout/suggestion" />
</LinearLayout>
</ScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/ll_round"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_marginBottom="7dp"
android:orientation="horizontal"
android: