Separated ListView and ExpandableListView

I need to create a layout with a title at the top and a list with n sections. the heading of the list of each section has two different buttons that must be interactive and can be configured independently of each other. This is the layout code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:orientation="vertical">

    <include layout="@layout/title_bar" />

    <ListView android:id="@android:id/list" 
      android:layout_width="fill_parent"
      android:layout_height="0dip" 
      android:layout_weight="1.0"   
    />
</LinearLayout>

I tried these two solutions, but I found problems that I can not solve in both cases:

1) Using a partitioned adapter (source code can be found here ). It works fine without a title, but with a title, the default focus algorithm no longer works.

2) Using the ExpandableListAdapter (in this case, obviously, the ListView in the layout becomes an ExpandableListView). It works fine, but if I click on the central dpad button in the group layout, press both buttons. I did not find a way to solve this problem.

Anyone can help?

Many thanks!

+3
source share
1 answer

How to try adapter merging https://github.com/commonsguy/cwac-merge it allows you to add multiple lists and buttons!

0

Source: https://habr.com/ru/post/1760756/


All Articles