The essence of the problem is this: you need to display a list of strings, the number of these changes, on the fragment besides the listView there are more elements, how to make the ListView take up as much space on the fragment as there are lines on it?

  • you need to show the layout of your container, perhaps the height setting of the wrap_content listView will be enough. - Shwarz Andrei

2 answers 2

This solution helped, just create your ListView: link

public class MyListView extends ListView {

public MyListView(Context context, AttributeSet attrs) { super(context, attrs); } public MyListView(Context context) { super(context); } public MyListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } 

}

    Set the size of the listView wrap_content . Then try adding the binding of the next item to the listView . In the markup to the next element, add android:layout_below="@+id/listView_id" . It may work only with RelativeLayout .