9. solve the problem that the ListView height cannot be fully displayed when ScrollView and ListView coexist.
Problem:
When ScrollView and ListView coexist, the ListView displays only one row, and other rows cannot be displayed.
Solution:
Rewrite the ListView as follows to solve the problem.
/** Solve the problem that when ScorllView and ListView coexist, the ListView only displays one row but not all.
* @ Author Caiyuan Huang
* 2014-9-26
*/
Public class CustomListView extends ListView {
Public CustomListView (Context context ){
Super (context );
// TODO Auto-generated constructor stub
}
Public CustomListView (Context context, AttributeSet attrs ){
Super (context, attrs );
// TODO Auto-generated constructor stub
}
Public CustomListView (Context 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 );
}
}