Android Display HTML in a ListView

后端 未结 9 2107
情话喂你
情话喂你 2020-12-16 05:54

Sorry if this is obvious to everyone else but I am having a minor difficulty understanding how to display html inside my listview.

My list view is declared.

9条回答
  •  长情又很酷
    2020-12-16 06:17

    override getItem method of the Adapter and do the following:

    ArrayAdapter adapter= ArrayAdapter(SearchByFood.this, R.layout.new_list_view, arr_sort){
         public Object getItem(int position)
         {
              return Html.fromHtml(arr_sort.get(position));
         }
    };
    

提交回复
热议问题