我無法在我的應用程序中顯示任何東西ListView
。我確信ListView
的適配器正在正確設置(並且我可以使用Log.d讀取其中的數據來確認),所以我猜這個問題是在XML佈局中。我有一個自動完成框和屏幕頂部的按鈕,下面有ListView
。 AutoComplete
和Button
顯示正常,但我沒有看到任何ListView
。Android佈局問題 - ListView無法顯示
我現在唯一能想到的是,我可以做一些奇怪的事情,LinearLayouts
阻止ListView
顯示,或類似的東西。我一直在閱讀所有可以在Android佈局上使用的文檔,但是沒有看到任何看起來可以幫助的文檔......有人可以幫我弄清楚爲什麼ListView沒有顯示出來?
<?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>
看看Eclipse中的XML文件的圖形佈局。如果它的權利,然後看看你使用這個XML文件的活動代碼。這個XML在我的項目中工作正常。 – user370305
在layout_height = wrap_content – MKJParekh
列表中輸入錯誤謝謝,修正了錯字,但仍然沒有骰子。 – DashRantic