根据书本经验,只设置上边框或者下边框有一个简单方法:
1.在目标TextView需要加边框的地方再加一个textview,
2.设置高度为1dp
3.设置background为想要的颜色即可
<TextView
android:id="@+id/tv_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#4003DAC8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />