Android 水平线布置新线

Android 水平线布置新线,android,xml,android-linearlayout,Android,Xml,Android Linearlayout,我看到了这个答案,但我的问题是: 如果不嵌套线性布局,是否无法实现这一点 尝试使用此代码 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > &

我看到了这个答案,但我的问题是: 如果不嵌套线性布局,是否无法实现这一点

尝试使用此代码

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    >
    <View
        android:layout_width="fill_parent"
        android:layout_height="1.5dp"
        android:background="@color/green"/>
</LinearLayout>

我想从代码中添加未知数量的视图