How to fix this ArrayAdapter requires the resource ID to be a TextView

后端 未结 3 1778
离开以前
离开以前 2021-01-29 08:47

I am new to android, I\'m trying to develop an application with gridview and listview using json. Through json I displayed set of images in gridview and based on the position of

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-29 09:29

    You need to override [ArrayAdapter.getView(int, View, ViewGroup)](http://developer.android.com/reference/android/widget/ArrayAdapter.html#getView(int, android.view.View, android.view.ViewGroup)). See http://developer.android.com/reference/android/widget/ArrayAdapter.html

    To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, override getView(int, View, ViewGroup) to return the type of view you want.

提交回复
热议问题