开发环境:Android studio 2.2.1
项目使用自带的Scrolling Activity
附上布局文件,我随便写的,懒得用include
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.NestedScrollView 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" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.example.****************.sensor.ScrollingActivity" tools:showIn="@layout/activity_scrolling"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:orientation="vertical" android:gravity="center_horizontal" android:layout_width="match_parent" android:background="@android:color/holo_orange_light" android:layout_height="wrap_content" android:layout_margin="16dp"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/pressures" android:id="@+id/imageView" /> <TextView android:text="压力" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/textView" android:textSize="18dp" android:textStyle="normal|bold" android:layout_marginLeft="10dp" android:layout_marginBottom="10d