how to convert listview to gridview

前端 未结 5 687
梦毁少年i
梦毁少年i 2021-01-02 20:04

below is my code which works fine for showing listview horizontally. how can I change it to gridvew. What changes should I make to change it to gridview? help me please

5条回答
  •  死守一世寂寞
    2021-01-02 20:48

    Use GridView instead of below:

    Then replace

    listview = (HorizontalListView) this.findViewById(R.id.listview2);
    

    to

    GridView gridview;
    gridview=(GridView) findViewById(R.id.gridview);
    

    Everything else are fine, just set Adapter using GridView object. And you are done.

提交回复
热议问题