android - 分隔线未显示在 ExpandableListView Android 中的第一个元素之上
解决方案
分隔线应该放在底部,而不是放在物品的顶部。有解决方法。在您的文件夹中创建分隔线,Drawable
如下所示:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="1dp"
android:color="@color/backgroundGray" />
</shape>
给它你想要的颜色。
现在在您的 XML 中ExpandableListView
执行以下操作:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/divider_gray"/>
<ExpandableListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@drawable/divider_gray"/>
</LinearLayout>
这样,您将在顶部有一个分隔线,ExpandableListView
并且在项目之间也ExpandableListView
将有相同的分隔线。
推荐阅读
- javascript - Javascript在不使用解析的情况下添加两个字符串数字
- python - Numpy.var() 和 Pandas.var() 的不同值
- javascript - 当我的 Vue 应用程序无法在 IE11 上呈现时,如何显示免责声明屏幕?
- python - 如何在 Keras 中实现具有动态形状的自定义输出层?
- arrays - 反向过滤数组 Angular
- excel - 如果在指定列中找到相同的值,则为单元格着色
- python - “ImportError:DLL 加载失败:找不到指定的模块。” NIC4 库
- javascript - 在 Reactjs 中使用 firebase 电话身份验证时出现“firebaseApp.auth.RecaptchaVerifier 不是构造函数”错误
- node.js - 为什么 secp256k1 privateKeys 在 nodejs 中并不总是 32 字节?
- python - 在熊猫中选择行时混淆轴的使用