There are many solutions to the problem that expandablelistview is not displayed normally due to nested expandablelistview in scrollview. Here we will introduce a method that can be used for personal testing.
Override expandablelistview:
Package COM. jph. view; import android. content. context; import android. util. attributeset; import android. widget. expandablelistview;/*** rewrite expandablelistview to solve the problem of expandablelistview nested in scrollview * <br> leading to abnormal display of expandablelistview * @ author jph * Date: 2014.10.21 */public class customexpandablelistview extends expandablelistview {public partition (context) {super (context); // todo auto-generated constructor stub} public partition (context, attributeset attrs) {super (context, attrs); // todo auto-generated constructor stub} public mexmexpandablelistview (context, attributeset attrs, int defstyle) {super (context, attrs, defstyle ); // todo auto-generated constructor stub} @ override protected void onmeasure (INT widthmeasurespec, int heightmeasurespec) {// todo auto-generated method stub int expandspec = measurespec. makemeasurespec (integer. max_value> 2, measurespec. at_most); super. onmeasure (widthmeasurespec, expandspec );}}
Replace expandablelistview with the rewritten expandablelistview in XML.
<com.jph.view.CustomExpandableListView android:id="@+id/elItems" android:layout_width="match_parent" android:layout_height="wrap_content"/>
The nested expandablelistview of scrollview is abnormal.