<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:visible="true"
android:shape="line">
<stroke
android:width="1dp"
android:color="#008000"
android:dashWidth="2dp"
android:dashGap="2dp"/>
</shape>
#horizontal_line.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate
android:fromDegrees="90"
android:toDegrees="90"
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/horizontal_line"
>
</rotate>
#以上是垂直线的XML代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dark_red_color">
<View
android:layout_width="50dp"
android:layout_height="310dp"
android:background="@drawable/vertical_line"
>
</View>
</LinearLayout>
我正在尝试在以上布局或视图中使用竖线。但是,竖线无法完全延伸到其高度。