线与XML没有出现在Android的
问题描述:
所以我想画一条直线在我layout.Here是我的代码线与XML没有出现在Android的
<View
android:layout_width="5dp"
android:layout_height="fill_parent"
android:background="#FF0000FF"
android:layout_marginStart="20dp"/>
它与一个水平线上,但没有显示出来时,它的垂直线。任何帮助将是伟大的!
答
你可以试试这个代码
对于水平线
<View
android:layout_width="match_parent"
android:layout_height="2dp" //You can change height according to your need
android:background="#000000" // For transparency you can use #80000000(where 80 denote the alpha value)
/>
对于垂直线
<View
android:layout_width="2dp" //You can change width according to your need
android:layout_height="match_parent"
android:background="#000000"
/>
您的片段是完全一个RelativeLa里面包裹时工作YOUT。发布完整的布局文件。 –