can ListView be inside ExpandableListView?

jory picture jory · Mar 5, 2013 · Viewed 9.2k times · Source

can we have ListView inside ExpandableListView so that I can have group level first and then array of child (listView). i already finish from listview classes and it works perfectly! but how to call each group in expandable list view to display list view (layout)! and get the correct child ! please can any one help ! thanks.

Answer

bardi picture bardi · Apr 3, 2014

Actually you can put a scrollable view (e.g. your ListView) inside another scrollable view (e.g. your ExpandableListView) and make the former scrollable in the following way:

listView.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        // disallow the onTouch for your scrollable parent view 
        v.getParent().requestDisallowInterceptTouchEvent(true);
        return false;
    }
});