The nested expandablelistview of scrollview is abnormal.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.