android - android listview 中的垂直分隔线不起作用

标签 android android-layout android-listview

我有一个 ListView ,我需要在其中显示联系人图片及其详细信息。 格式:

垂直分隔符根本没有出现! 这是我的 listitem 布局文件: [这里使用相对布局,因为我有更多 View 要添加到列表中相对]

<ImageButton android:id="@+id/pic"
                                  android:layout_alignParentTop="true"
                                  android:layout_alignParentLeft="true"/>      

<ImageView android:id="@+id/vertical_separator"
           android:orientation="vertical"
           android:layout_width="wrap_content"
           android:layout_height="fill_parent"
           android:background="@android:drawable/divider_vertical_bright"
           android:layout_toRightOf="@id/badge"
           android:layout_alignWithParentIfMissing="true"/>                                

<TextView android:id="@+id/details"
          android:layout_toRightOf="@id/verticalseparator"
          android:layout_alignTop="@id/badge"
          android:layout_alignWithParentIfMissing="true"/>

即使高度为 "fill_parent",分隔符在联系人图片后显示为一个小点。我尝试将宽度更改为 2dp ..但还是一样。

--我使用一个ListAdapter来填充这个类型的列表:

我在这里遗漏了什么吗?水平分隔线显示正确,但垂直分隔线显示不正确

最佳答案

我认为 ImageView 和 TextView 中的“@id/badge”应该改为“@id/pic”。 (或者反过来。)

关于android - android listview 中的垂直分隔线不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4324889/

相关文章:

android - 属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) 来自 [com.android.support :support-compat:28. 0.0]

java - 框架布局 : How to add other Views on top of GLSurfaceView?

Android布局: group dynamic elements

java - 如何为自定义 baseadapter 类中的项目设置自定义 ListView 字体

android - 如何使用 Listview 访问多个 JSONArray?

javascript - 将 HTML 文件中的外部 javascript 文件从 Android Assets 文件夹加载到 WebView 中

android - 将 JSONArray 转换为普通数组

android - 在透明 SurfaceView 之上添加 View ?

Android - 当背景为 imageview 时,旋转箭头不显示

android - ListView 项目未显示为已激活