简体   繁体   中英

Removing the divider for (n-1)th item in an Expandable List View?

I would like to remove the divider for the last but one th item of a ListView .

android:footerDividersEnabled="false" removes the divider for the last item, but I want to remove divider for the item above the last item . How can I do this?

I'm solving this issue pragmatically by adding the following to my group layout

Put your group layout into a parent relative layout and then add this to this layout

    <View android:id="@+id/divider_view"
        android:layout_height="1dp"
        android:layout_width="match_parent"
        android:background="@drawable/your_divider"
        android:layout_alignBottom="@+id/parent_layout_id"/>

Then in your adapter getGroupView() add the following

if(groupPosition == mGrouplist.size() -1)
{
    dividerView.setVisibilty(View.GONE)
}else
{
    dividerView.setVisibilty(View.VISIBLE)
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM