-3
A
回答
0
您需要創建自定義列表視圖,並在您的列表適配器的getView()
方法中,您可以使用if條件檢查位置並膨脹所需的佈局。 如:
if(position==2){
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.your_layout1, null);
}else if(position==5){
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.your_layout2, null);
}
對於自定義的ListView可以通過這個教程: Link
+0
謝謝 Aamir –
0
你不需要自定義列表視圖。
您有幾種選擇,包括:
- 使用相同的佈局,只是隱藏你不想顯示的元素。
- 執行view holder pattern並使用不同的視圖。
你也可以使用RecyclerView,我建議。
相關問題
- 1. 我怎樣才能在%相對DIV
- 2. 我怎樣才能把箭頭放在listview同一行?
- 3. 我怎樣才能
- 4. 我怎樣才能
- 5. 我怎樣才能
- 6. 我怎樣才能
- 7. 我怎樣才能在Ionic2
- 8. 我怎樣才能在Zebble
- 9. 我怎樣才能在PreferenceScreen
- 10. 我怎樣才能在vim
- 11. 我怎樣才能在圖
- 12. 我怎樣才能在Python
- 13. 我怎樣才能在VB.net
- 14. 我怎樣才能在DB2
- 15. 我怎樣才能在Java
- 16. 我怎樣才能在Python
- 17. 我怎樣才能在PAM
- 18. 我怎樣才能在JSP
- 19. 我怎樣才能在RSPEC
- 20. 我怎樣才能在logstash
- 21. 我怎樣才能在Doctrine2
- 22. 我怎樣才能在Python
- 23. 我怎樣才能在vb.net
- 24. 我怎樣才能在SAS
- 25. 我怎樣才能在laravel
- 26. 我怎樣才能在GGPLOT2
- 27. 我怎樣才能在AngularJS
- 28. 我怎樣才能在Django
- 29. 我怎樣才能在Firefox
- 30. 我怎樣才能在Python
您在詢問不同行中的不同佈局?或者是別的什麼。請清除您的問題 –