To increase the listview height, I am using exbandable ListView as,
public class ExpandableListView extends ListView {
private android.view.ViewGroup.LayoutParams params;
private int old_count = 0;
public ExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
if (getCount() != old_count) {
old_count = getCount();
params = getLayoutParams();
params.height = getCount() * (old_count > 0 ? getChildAt(0).getHeight() : 0);
System.out.println("params h "+params.height+" "+params);
setLayoutParams(params);
}
super.onDraw(canvas);
}
}
layout.xml as,
<com.jems.realtimedata.ExpandableListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="25dp"
android:background="@color/list_back"
android:cacheColorHint="#00000000"
android:divider="@drawable/line"
android:paddingLeft="7dp"
android:paddingRight="7dp"
android:paddingTop="10dp"
android:scrollbars="none" />
But,last item of list not displaying properly. I used utility class also,but no change in list.Any other solution to extend the view.Please help me to solve this issues.