Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can set the height of the ListView to the height of one item using the following steps in Android Studio:

  1. Open the layout file where your ListView is defined.
  2. Locate the ListView element and add the following attributes:
android:layout_height="wrap_content"
android:maxHeight="your_item_height"

Replace "youritemheight" with the height of one item in your ListView. You can either hardcode the value or calculate it programmatically. 3. Run your app and observe the ListView. It should now only display one item with no extra space above or below it.