I am having trouble getting a ListView to display anything in my application. I am sure the ListView‘s adapter is getting set correctly (and I can read out the data in it using Log.d to confirm), so I’m guessing the issue is in the XML layout. I have an autocomplete box and the button on the top of the screen, with the ListView underneath. Both the AutoComplete and the Button display fine and work correctly, however I see nothing whatsoever for the ListView.
The only thing I can think of at the moment is that I could be doing something weird with the LinearLayouts that prevent the ListView from displaying, or something similar. I’ve been reading all the docs I can on Android layouts, but haven’t run across anything that looks like it can help yet… Can someone help me figure out why the ListView is not being displayed at all?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:padding="5dp"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp" android:weightSum="1">
<com.myapp.CustomAutoCompleteTextView
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:fadeScrollbars="false"
android:id="@+id/autocomplete_itemname"
android:layout_width="fill_parent"
android:layout_weight="0.90"/>
<Button android:text="Locate"
android:layout_width="wrap_content"
android:id="@+id/button_item_list_located_item"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
<ListView android:id="@+id/selected_items_listview"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</LinearLayout>

Try changing the
layout_heightof your wrapping rootLinearLayoutto"fill_parent"instead of"match_parent"