歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Android 自定義Adapter 但listview 只顯示第一條數據

Android 自定義Adapter 但listview 只顯示第一條數據

日期:2017/3/1 9:44:10   编辑:Linux編程

Android 自定義Adapter 但listview 只顯示第一條數據這個問題郁悶了一晚上。在logcat裡明明顯示adapter的getview方法裡的list大於一條數據 ,但posotion卻一直是0.。運行後也只顯示list[0]裡面的數據。最後的最後原來錯誤出在布局文件上

-------------------------------------------分割線-------------------------------------------

Ubuntu 14.04 x64配置Android 4.4 kitkat編譯環境的方法 http://www.linuxidc.com/Linux/2014-05/101148.htm

Ubuntu 12.04搭建Android開發環境 http://www.linuxidc.com/Linux/2012-09/69961.htm

Ubuntu 14.04 配置 Android SDK 開發環境 http://www.linuxidc.com/Linux/2014-05/101039.htm

64位Ubuntu 11.10下Android開發環境的搭建(JDK+Eclipse+ADT+Android SDK詳細) http://www.linuxidc.com/Linux/2013-06/85303.htm

Ubuntu 12.10 x64 安裝 Android SDK http://www.linuxidc.com/Linux/2013-03/82005.htm

-------------------------------------------分割線-------------------------------------------

我以前的是這樣的;

<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>

<!-- listview -->
<ListView android:id="@+id/listview1" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:drawSelectorOnTop="false"
android:background="@drawable/home_index_btn_d"
android:fadingEdge="none"
android:cacheColorHint="#00000000"

android:scrollbars="vertical" />

</ScrollView>

都是這個ScrollView惹的禍。。。去掉之後 就OK了

更多Android相關信息見Android 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=11

Copyright © Linux教程網 All Rights Reserved