I am a beginner to android. I want to display a customized list view which contains a number. I customized my ListView
size(android:layout_height=\"50dp\"
This should help you out..
ListAdapter listadp = lv_ancillaryservice.getAdapter();
if (listadp != null) {
int totalHeight = 0;
for (int i = 0; i < listadp.getCount(); i++) {
View listItem = listadp.getView(i, null, lv_ancillaryservice);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = lv_ancillaryservice.getLayoutParams();
params.height = totalHeight + (lv_ancillaryservice.getDividerHeight() * (listadp.getCount() - 1));
lv_ancillaryservice.setLayoutParams(params);
lv_ancillaryservice.requestLayout();