Android LinearLayout horizontal 添加分割线不显示 解决方案

    xiaoxiao2021-03-25  97

    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>

    转载请注明原文地址: https://ju.6miu.com/read-14733.html

    最新回复(0)