智能农业项目总结
首先,先在build.gradle添加项目所需要的所有的数据包
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
一.创建页面布局,实现界面转换(举例首页布局)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" tools:context="android.coolweather2.com.agriculturedemo.fragment.HomePageFragment">
<TextView
android:id="@+id/home_page_top_lin"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_horizontal"
android:text="智能农业"
android:textColor="#24bd3b"
android:textSize="30dp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/main_bottom_lin"
android:layout_alignParentLeft="true"
android:layout_below="@+id/home_page_top_lin"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/home_page_vp"
android:layout_width="match_parent"
android:layout_height="150dp">
</android.support.v4.view.ViewPager>
<View
android:layout_width="match_parent"
android:layout_height="20dp" />
<include layout="@layout/co2" />
<View
android:layout_width="match_parent"
android:layout_height="20dp" />
<include layout="@layout/light" />
<View
android:layout_width="match_parent"
android:layout_height="20dp" />
<include layout="@layout/soil" />
<View
android:layout_width="match_parent"
android:layout_height="20dp" />
<include layout="@layout/air" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
CO2界面代码(将方形图片转换成圆形图片)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:app="http://sche