Android LinearLayout horizontal 添加分割线不显示 解决方案
Android 踩过的那些坑 ,我们在设置LinearLayout 分割线时 发现android:orientation="horizontal"时 分割线显示不出来
原因就是shape文件属性的问题
不显示的shape 文件写法是:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/fengexian" />
<size android:height="1px"/>
</shape>
正确的写法:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/fengexian" />
<size android:height="1px"
android:width="1px" />
</shape>

本文介绍了解决Android中LinearLayout使用horizontal方向时分割线不显示的问题。通过修改shape文件中的size标签,增加width属性为1px,成功实现了分割线的正确显示。
1万+

被折叠的 条评论
为什么被折叠?



