1、效果图如下:
2、布局最多嵌套三层,复杂布局再也不用担心嵌套层次更多啦
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<TextView
android:id="@+id/header_tv"
android:layout_width="0dp"
android:layout_height="44dp"
android:background="@color/colorAccent"
android:gravity="center"
android:text="旅游介绍"
android:textColor="@android:color/white"
android:textSize="16sp"
android:elevation="8dp"
android:translationZ="8dp"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header_tv">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.constraint.Guideline
android:id="@+id/guide_line_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.333" />
<android.support.constraint.Guideline
android:id="@+id/guide_line_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.666" />
<ImageView
android:id="@+id/beach_iv"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginTop="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/guide_line_left"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_beach"
app:layout_constraintHorizontal_bias="0.452" />
<ImageView
android:id="@+id/desert_iv"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_desert" />
<ImageView
android:id="@+id/forest_iv"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="@id/guide_line_right"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_forest" />
<TextView
android:id="@+id/desert_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="沙漠"
android:textSize="13sp"
app:layout_constraintLeft_toLeftOf="@id/guide_line_left"
app:layout_constraintRight_toLeftOf="@id/guide_line_right"
app:layout_constraintTop_toBottomOf="@id/desert_iv" />
<TextView
android:id="@+id/beach_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="沙滩"
android:textSize="13sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/guide_line_left"
app:layout_constraintTop_toTopOf="@id/desert_tv" />
<TextView
android:id="@+id/forest_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="森林"
android:textSize="13sp"
app:layout_constraintLeft_toLeftOf="@id/guide_line_right"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/desert_tv" />
<!--***************************************************************************************-->
<ImageView
android:id="@+id/island_iv"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginTop="24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/guide_line_left"
app:layout_constraintTop_toBottomOf="@id/desert_tv"
app:srcCompat="@drawable/ic_island" />
<ImageView
android:id="@+id/mountain_iv"
android:layout_width="44dp"
android:layout_height="44dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/island_iv"
app:srcCompat="@drawable/ic_mountain" />
<ImageView
android:id="@+id/waterfall_iv"
android:layout_width="44dp"
android:layout_height="44dp"
app:layout_constraintLeft_toLeftOf="@+id/guide_line_right"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/island_iv"
app:srcCompat="@drawable/ic_waterfall" />
<TextView
android:id="@+id/mountain_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="高山"
android:textSize="13sp"
app:layout_constraintLeft_toLeftOf="@id/guide_line_left"
app:layout_constraintRight_toLeftOf="@id/guide_line_right"
app:layout_constraintTop_toBottomOf="@id/mountain_iv" />
<TextView
android:id="@+id/island_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="海岛"
android:textSize="13sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/guide_line_left"
app:layout_constraintTop_toTopOf="@id/mountain_tv" />
<TextView
android:id="@+id/waterfall_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="瀑布"
android:textSize="13sp"
app:layout_constraintLeft_toLeftOf="@id/guide_line_right"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/mountain_tv" />
<!--***************************************************************************************-->
<TextView
android:id="@+id/hot_tv"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_marginTop="16dp"
android:background="#fff6f7f9"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="热门游记"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/mountain_tv" />
<TextView
android:id="@+id/whole_tv"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:gravity="center_vertical"
android:text="查看全部"
android:tint="@android:color/white"
android:textColor="#FF5296F0"
app:layout_constraintBottom_toBottomOf="@id/hot_tv"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/hot_tv" />
<!--***************************************************************************************-->
<ImageView
android:id="@+id/arrow_iv"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:padding="8dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/whole_tv"
app:srcCompat="@drawable/icon_arrow" />
<TextView
android:id="@+id/title_tv"
android:layout_width="0dp"
android:layout_height="32dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:text="1. 书写着火山奇迹的理想之地"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/arrow_iv"
app:layout_constraintTop_toBottomOf="@id/hot_tv" />
<TextView
android:id="@+id/subtitle_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:lineSpacingMultiplier="1.2"
android:text="又到2月14日情人节,要说最不激动,最没诗意、最不浪漫的,也是最为淳朴、最为踏实的,就是我们这种“老夫老妻”,尽管这个浪漫的节日已经超级商业化,我们本身也这么认为,但心依旧。"
android:textSize="14sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_tv" />
<!--***************************************************************************************-->
<ImageView
android:id="@+id/arrow_2_iv"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:padding="8dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/subtitle_tv"
app:srcCompat="@drawable/icon_arrow" />
<TextView
android:id="@+id/title_2_tv"
android:layout_width="0dp"
android:layout_height="32dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:text="2. 情系大西北游记"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/arrow_2_iv"
app:layout_constraintTop_toBottomOf="@id/subtitle_tv" />
<TextView
android:id="@+id/subtitle_2_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:lineSpacingMultiplier="1.2"
android:text="一整晚没睡,凌晨3点早早就蹦去 深圳 机场…还是一如既往、开错了路,挨着骂终于赶上了飞机! 出发出发出发!大 西北 ,我们来咯、准备开启8天的三人行哟! "
android:textSize="14sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_2_tv" />
<!--***************************************************************************************-->
<ImageView
android:id="@+id/arrow_3_iv"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:padding="8dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/subtitle_2_tv"
app:srcCompat="@drawable/icon_arrow" />
<TextView
android:id="@+id/title_3_tv"
android:layout_width="0dp"
android:layout_height="32dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:text="3. 只是想出去走一走——7天6西安游~"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/arrow_3_iv"
app:layout_constraintTop_toBottomOf="@id/subtitle_2_tv" />
<TextView
android:id="@+id/subtitle_3_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:lineSpacingMultiplier="1.2"
android:text="写在前面的话:旅行是一件会上瘾的事情。只要开始了,就停不下来。"
android:textSize="14sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_3_tv" />
<!--***************************************************************************************-->
<ImageView
android:id="@+id/arrow_4_iv"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:padding="8dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/subtitle_3_tv"
app:srcCompat="@drawable/icon_arrow" />
<TextView
android:id="@+id/title_4_tv"
android:layout_width="0dp"
android:layout_height="32dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:text="4. 我画中的八月黄姚-美丽桂林"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/arrow_4_iv"
app:layout_constraintTop_toBottomOf="@id/subtitle_3_tv" />
<TextView
android:id="@+id/subtitle_4_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:lineSpacingMultiplier="1.2"
android:text="这篇游记开始写文字部分的时候已经是十月份了,不过似乎这十天的行程陪伴到了我十月。大家肯定也会问我一个问题,这些画是你在旅途中画的吗?答案:不是!"
android:textSize="14sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginBottom="16dp"
app:layout_constraintTop_toBottomOf="@id/title_4_tv" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
</android.support.constraint.ConstraintLayout>