2014-12-03 13 views
0

我有一個如下所示的JSON數組。我需要使用這個數組來填充一個listview,但是我在JSON中有另一個數組(註釋),我希望使用它來使用addview()來填充列表項中的一個線性佈局。我如何設計我的列表適配器,我需要的評論也可以點擊。如何在可點擊的列表項中使用layout inflater和addview

[ 
{ 
    "name": "Hopewell Mutanda", 
    "answer": "This is my answer", 
    "votes": 10, 
    "date": 20-06-2014, 
    "comments": [ 
       { 
        "comment": "This is a great answer", 
        "name": "Gloria Nyakudya", 
        "date": 21-10-2014, 
        "vote": 20, 
       }, 
       { 
        "comment": "This is the second great answer", 
        "name": "Pelagia Chirenga", 
        "date": 21-10-2014, 
        "vote": 10, 
       }, 
       { 
        "comment": "This is the third great answer", 
        "name": "Pelagia Chirenga", 
        "date": 21-10-2014, 
        "vote": 0, 
       }, 
       ] 
}, 
{ 
    "name": "Tinashe Makaza", 
    "answer": "This is the second answer", 
    "votes": 10, 
    "date": 20-06-2014, 
    "comments": [ 
       { 
        "comment": "This is a great answer", 
        "name": "Gloria Nyakudya", 
        "date": 21-10-2014, 
        "vote": 20, 
       }, 
       { 
        "comment": "This is the second great answer", 
        "name": "Pelagia Chirenga", 
        "date": 21-10-2014, 
        "vote": 10, 
       }, 
       { 
        "comment": "This is the third great answer", 
        "name": "Pelagia Chirenga", 
        "date": 21-10-2014, 
        "vote": 0, 
       }, 
       ] 
}, 

] 

這是我希望實現的東西的圖像鏈接。在這種佈局中,每個值是硬編碼

http://encodable.com/uploaddemo/files/Screenshot_2014-12-02-23-55-33.png

回答

相關問題