两种方法
<?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="match_parent"
android:orientation="vertical"
android:divider="@drawable/fengexian"
android:showDividers="middle"
android:dividerPadding="10dp">
<!--设置分割线1:使用LinearLayout的一个divider属性-->
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮3" />
<!-- 设置分割线2-->
<View
android:layout_width="match_parent"
android:layout_height="3px"
android:background="#000000" />
</LinearLayout>